diff --git a/v1.4.3/Exemplo/uPrincipal.dfm b/v1.4.3/Exemplo/uPrincipal.dfm
index b5aff10..c358dd6 100644
--- a/v1.4.3/Exemplo/uPrincipal.dfm
+++ b/v1.4.3/Exemplo/uPrincipal.dfm
@@ -3848,9 +3848,9 @@ object Form1: TForm1
object btnEnviarTxtComBTInline: TButton
Left = 146
Top = 159
- Width = 137
+ Width = 151
Height = 25
- Caption = 'Send Text w/ Buttons Inline'
+ Caption = 'Send Text w/ Inline Buttons '
Default = True
TabOrder = 19
OnClick = btnEnviarTxtComBTInlineClick
@@ -3952,9 +3952,9 @@ object Form1: TForm1
OnClick = EnviarFotoSpoilerClick
end
object SendTextTopic: TButton
- Left = 289
- Top = 159
- Width = 137
+ Left = 146
+ Top = 190
+ Width = 151
Height = 25
Caption = 'Send Text for Topic'
Default = True
@@ -4135,8 +4135,8 @@ object Form1: TForm1
end
object InjectTelegramExceptionManagerUI1: TInjectTelegramExceptionManagerUI
OnLog = InjectTelegramExceptionManagerUI1Log
- Left = 208
- Top = 326
+ Left = 488
+ Top = 438
end
object cuHttpClientSysNet1: TcuHttpClientSysNet
Left = 488
@@ -4155,8 +4155,8 @@ object Form1: TForm1
OnReceiveRawData = InjectTelegramBot1ReceiveRawData
OnSendData = InjectTelegramBot1SendData
OnDisconect = InjectTelegramBot1Disconect
- Left = 48
- Top = 326
+ Left = 488
+ Top = 382
end
object BotManager1: TInjectTelegramBotManager
Bot = InjectTelegramBot1
@@ -4181,6 +4181,6 @@ object Form1: TForm1
OnGeneralForumTopicUnhidden = BotManager1GeneralForumTopicUnhidden
OnMessageEntityReceiver = BotManager1MessageEntityReceiver
Left = 360
- Top = 328
+ Top = 400
end
end
diff --git a/v1.4.4/CrossUrl/Core/CrossUrl.HttpClient.pas b/v1.4.4/CrossUrl/Core/CrossUrl.HttpClient.pas
new file mode 100644
index 0000000..1681f24
--- /dev/null
+++ b/v1.4.4/CrossUrl/Core/CrossUrl.HttpClient.pas
@@ -0,0 +1,94 @@
+unit CrossUrl.HttpClient;
+
+interface
+
+uses
+ System.Classes,
+ System.SysUtils;
+
+type
+ TcuProxy = record
+ private
+ FHost: string;
+ FPort: Integer;
+ FUserName: string;
+ FPassword: string;
+ public
+ constructor Create(const AHost: string; APort: Integer; const AUserName:
+ string = ''; const APassword: string = '');
+ property Host: string read FHost write FHost;
+ property Port: Integer read FPort write FPort;
+ property UserName: string read FUserName write FUserName;
+ property Password: string read FPassword write FPassword;
+ end;
+
+ IcuUri = interface
+ ['{46DF4232-C572-45F8-8CAB-86096F32FA66}']
+ function GetScheme: string;
+ procedure SetScheme(const Value: string);
+ property Scheme: string read GetScheme write SetScheme;
+ end;
+
+ IcuMultipartFormData = interface
+ ['{C1FEF918-67B9-4503-B67F-AD942F16FEB3}']
+ function GetStream: TStream;
+ //
+ procedure AddField(const AField, AValue: string);
+ procedure AddFile(const AFieldName, AFilePath: string);
+ ///
+ /// Add a form data Stream
+ ///
+ ///
+ /// Field Name
+ ///
+ ///
+ /// Stream
+ ///
+ ///
+ /// file name: "File.ext"
+ ///
+ procedure AddStream(const AFieldName: string; Data: TStream; const AFileName:
+ string = '');
+ property Stream: TStream read GetStream;
+ end;
+
+ IcuHttpResponse = interface
+ ['{44F74F9B-CCD2-475E-95E0-02DA30AC749D}']
+ //private
+ function GetStatusCode: Integer;
+ function GetStatusText: string;
+ function GetContentStream: TStream;
+ //public
+ property StatusText: string read GetStatusText;
+ property StatusCode: Integer read GetStatusCode;
+ property ContentStream: TStream read GetContentStream;
+ function ContentAsString(const AnEncoding: TEncoding = nil): string;
+ end;
+
+ IcuHttpClient = interface
+ ['{EB3348C4-5651-4BAB-988D-A28794FEB149}']
+ function GetProxy: TcuProxy;
+ procedure SetProxy(const AProxy: TcuProxy);
+ //
+ function CreateMultipartFormData: IcuMultipartFormData;
+ function Get(const AUrl: string): IcuHttpResponse;
+ function Post(const AURL: string; const ASource: IcuMultipartFormData):
+ IcuHttpResponse;
+ property Proxy: TcuProxy read GetProxy write SetProxy;
+ end;
+
+implementation
+
+{ TcuProxy }
+
+constructor TcuProxy.Create(const AHost: string; APort: Integer; const AUserName,
+ APassword: string);
+begin
+ FHost := AHost;
+ FPort := APort;
+ FUserName := AUserName;
+ FPassword := APassword;
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/Core/CrossUrl.dpk b/v1.4.4/CrossUrl/Core/CrossUrl.dpk
new file mode 100644
index 0000000..3446363
--- /dev/null
+++ b/v1.4.4/CrossUrl/Core/CrossUrl.dpk
@@ -0,0 +1,37 @@
+package CrossUrl;
+
+{$R *.res}
+{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO OFF}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION OFF}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES ON}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$DEFINE DEBUG}
+{$ENDIF IMPLICITBUILDING}
+{$DESCRIPTION 'Cross URL'}
+{$IMPLICITBUILD ON}
+
+requires
+ rtl;
+
+contains
+ CrossUrl.HttpClient in 'CrossUrl.HttpClient.pas';
+
+end.
diff --git a/v1.4.4/CrossUrl/Core/CrossUrl.dproj b/v1.4.4/CrossUrl/Core/CrossUrl.dproj
new file mode 100644
index 0000000..e13092d
--- /dev/null
+++ b/v1.4.4/CrossUrl/Core/CrossUrl.dproj
@@ -0,0 +1,1027 @@
+
+
+ {984584BD-F5BF-4226-86FA-F276A3B81854}
+ CrossUrl.dpk
+ 19.4
+ None
+ True
+ Release
+ Win32
+ 1
+ Package
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ .\$(Platform)\$(Config)
+ .\$(Platform)\$(Config)
+ false
+ false
+ false
+ false
+ false
+ true
+ true
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ All
+ CrossUrl
+
+
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ Debug
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar
+
+
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ Debug
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri;ITSAppUsesNonExemptEncryption=false;NSBluetoothAlwaysUsageDescription=The reason for accessing bluetooth;NSBluetoothPeripheralUsageDescription=The reason for accessing bluetooth peripherals;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSMotionUsageDescription=The reason for accessing the accelerometer;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ iPhoneAndiPad
+ true
+ Debug
+ $(MSBuildProjectName)
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ Debug
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ Debug
+ true
+ Base
+ true
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+ rtl;$(DCC_UsePackage)
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+
+
+ DEBUG;$(DCC_Define)
+ true
+ false
+ true
+ true
+ true
+
+
+ false
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+
+ MainSource
+
+
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+ Cfg_2
+ Base
+
+
+
+ Delphi.Personality.12
+ Package
+
+
+
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ CrossUrl.bpl
+ true
+
+
+
+
+ 1
+
+
+ 0
+
+
+
+
+ classes
+ 64
+
+
+ classes
+ 64
+
+
+
+
+ classes
+ 1
+
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+ res\xml
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+ .framework
+
+
+ 1
+ .framework
+
+
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+
diff --git a/v1.4.4/CrossUrl/Core/CrossUrl.res b/v1.4.4/CrossUrl/Core/CrossUrl.res
new file mode 100644
index 0000000..705d434
Binary files /dev/null and b/v1.4.4/CrossUrl/Core/CrossUrl.res differ
diff --git a/v1.4.4/CrossUrl/CrossUrl.pas b/v1.4.4/CrossUrl/CrossUrl.pas
new file mode 100644
index 0000000..a47a5ea
--- /dev/null
+++ b/v1.4.4/CrossUrl/CrossUrl.pas
@@ -0,0 +1,7 @@
+unit CrossUrl;
+
+interface
+
+implementation
+
+end.
diff --git a/v1.4.4/CrossUrl/CrossUrlProject.groupproj b/v1.4.4/CrossUrl/CrossUrlProject.groupproj
new file mode 100644
index 0000000..58c5a49
--- /dev/null
+++ b/v1.4.4/CrossUrl/CrossUrlProject.groupproj
@@ -0,0 +1,84 @@
+
+
+ {B1B0AA9C-8DE4-40E6-99FA-1601E40DC0D5}
+
+
+
+
+
+
+ Core\CrossUrl.dproj
+
+
+
+
+
+
+
+
+
+
+
+
+ Default.Personality.12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/v1.4.4/CrossUrl/Demo/Demo.dpr b/v1.4.4/CrossUrl/Demo/Demo.dpr
new file mode 100644
index 0000000..27c0b1d
--- /dev/null
+++ b/v1.4.4/CrossUrl/Demo/Demo.dpr
@@ -0,0 +1,49 @@
+program Demo;
+
+{$APPTYPE CONSOLE}
+
+{$R *.res}
+
+uses
+ CrossUrl.HttpClient,
+ CrossUrl.SystemNet.HttpClient,
+ CrossUrl.Indy.HttpClient,
+ System.SysUtils;
+
+const
+ SERVER = 'http://example.com/';
+
+procedure TestCore(Client: IcuHttpClient);
+var
+ r: IcuHttpResponse;
+begin
+ r := Client.Get(SERVER);
+ Writeln(r.StatusText);
+ Writeln(r.StatusCode);
+ Writeln(r.ContentAsString);
+end;
+
+procedure TestSysNet;
+begin
+ Writeln('Test System.Net: ');
+ TestCore(TcuHttpClientSysNet.Create(nil));
+end;
+
+procedure TestIndy;
+begin
+ Writeln('Test Indy: ');
+ TestCore(TcuHttpClientIndy.Create(nil));
+end;
+
+begin
+ try
+ { TODO -oUser -cConsole Main : Insert code here }
+ TestSysNet;
+ TestIndy;
+ except
+ on E: Exception do
+ Writeln(E.ClassName, ': ', E.Message);
+ end;
+ Readln;
+end.
+
diff --git a/v1.4.4/CrossUrl/Demo/Demo.dproj b/v1.4.4/CrossUrl/Demo/Demo.dproj
new file mode 100644
index 0000000..42eb4da
--- /dev/null
+++ b/v1.4.4/CrossUrl/Demo/Demo.dproj
@@ -0,0 +1,644 @@
+
+
+ {86147BCA-AD6D-4187-BEC5-50AE4F61A79E}
+ 18.6
+ None
+ Demo.dpr
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ .\$(Platform)\$(Config)
+ .\$(Platform)\$(Config)
+ false
+ false
+ false
+ false
+ false
+ RESTComponents;emsclientfiredac;DataSnapFireDAC;FireDACIBDriver;emsclient;FireDACCommon;RESTBackendComponents;soapserver;CloudService;FireDACCommonDriver;inet;FireDAC;FireDACSqliteDriver;soaprtl;soapmidas;$(DCC_UsePackage)
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ Demo
+ ..\Core;..\Indy;..\System.Net;$(DCC_UnitSearchPath)
+ 1049
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+
+
+ DBXSqliteDriver;DBXInterBaseDriver;tethering;bindcompfmx;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;ibmonitor;DbxCommonDriver;ibxpress;xmlrtl;DataSnapNativeClient;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar
+
+
+ DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;emsedge;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;emshosting;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;ibxpress;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;ObjectDebugger10Seattle;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+ true
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+
+
+ DEBUG;$(DCC_Define)
+ true
+ false
+ true
+ true
+ true
+
+
+ false
+ 1033
+ C:\Users\Максим\Documents\Embarcadero\Studio\Projects\(None)
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+
+ MainSource
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+ Delphi.Personality.12
+ Application
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Demo.dpr
+
+
+
+
+
+ true
+
+
+
+
+ Demo.exe
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ Contents\MacOS
+ 1
+ .framework
+
+
+ Contents\MacOS
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ Contents\Resources\StartUp\
+ 0
+
+
+ Contents\Resources\StartUp\
+ 0
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\
+ 1
+
+
+ ..\
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+ ..\
+ 1
+
+
+ ..\
+ 1
+
+
+
+
+ Contents
+ 1
+
+
+ Contents
+ 1
+
+
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ True
+
+
+ 12
+
+
+
+
+
diff --git a/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.HttpClient.pas b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.HttpClient.pas
new file mode 100644
index 0000000..a0d7803
--- /dev/null
+++ b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.HttpClient.pas
@@ -0,0 +1,111 @@
+unit CrossUrl.Indy.HttpClient;
+
+interface
+
+uses
+ CrossUrl.HttpClient,
+ System.Classes,
+ IdHTTP,
+ IdSSLOpenSSL;
+
+type
+ TcuHttpClientIndy = class(TComponent, IcuHttpClient)
+ private
+ FHttpClient: TIdHTTP;
+ FIdSSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
+ function GetProxy: TcuProxy;
+ procedure SetProxy(const AProxy: TcuProxy);
+ public
+
+ destructor Destroy; override;
+ function Get(const AURL: string): IcuHttpResponse;
+ function Post(const AURL: string; const ASource: IcuMultipartFormData):
+ IcuHttpResponse;
+ function CreateMultipartFormData: IcuMultipartFormData;
+ constructor Create(AOwner: TComponent); override;
+ property Proxy: TcuProxy read GetProxy write SetProxy;
+ end;
+
+implementation
+
+uses
+ CrossUrl.Indy.HttpResponse,
+ CrossUrl.Indy.MultipartFormData;
+{ TcuHttpClient }
+
+
+
+constructor TcuHttpClientIndy.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ FIdSSLIOHandlerSocketOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create(Nil);
+ FIdSSLIOHandlerSocketOpenSSL.SSLOptions.Method := sslvSSLv23;
+
+ FHttpClient := TIdHTTP.Create(nil);
+ FHttpClient.Request.Connection := 'Keep-Alive';
+ FHttpClient.Request.Accept := 'application/json';
+ FHttpClient.IOHandler := FIdSSLIOHandlerSocketOpenSSL;
+ FHttpClient.Request.CustomHeaders.Clear;
+ FHttpClient.Request.ContentType := 'application/json';
+ FHttpClient.HandleRedirects := True;
+ FHttpClient.Request.UserAgent := '';
+end;
+
+function TcuHttpClientIndy.CreateMultipartFormData: IcuMultipartFormData;
+begin
+ Result := TcuMultipartFormDataIndy.Create;
+end;
+
+destructor TcuHttpClientIndy.Destroy;
+begin
+ FHttpClient.Free;
+ FIdSSLIOHandlerSocketOpenSSL.Free;
+ inherited;
+end;
+
+function TcuHttpClientIndy.Get(const AUrl: string): IcuHttpResponse;
+var
+ LStream: TMemoryStream;
+begin
+ LStream := TMemoryStream.Create;
+ try
+ FHttpClient.Get(AUrl, LStream);
+ Result := TcuHttpResponce.Create(FHttpClient.Response, LStream);
+ finally
+ // LStream.Free;
+ end;
+end;
+
+function TcuHttpClientIndy.GetProxy: TcuProxy;
+begin
+ Result.Host := FHttpClient.ProxyParams.ProxyServer;
+ Result.Port := FHttpClient.ProxyParams.ProxyPort;
+ Result.UserName := FHttpClient.ProxyParams.ProxyUsername;
+ Result.Password := FHttpClient.ProxyParams.ProxyPassword;
+end;
+
+function TcuHttpClientIndy.Post(const AURL: string; const ASource:
+ IcuMultipartFormData): IcuHttpResponse;
+var
+ LStream: TMemoryStream;
+begin
+ LStream := TMemoryStream.Create;
+ try
+ FHttpClient.Post(AURL, (ASource as TcuMultipartFormDataIndy).GetCore);
+ Result := TcuHttpResponce.Create(FHttpClient.Response, LStream);
+ finally
+ // LStream.Free;
+ end;
+end;
+
+procedure TcuHttpClientIndy.SetProxy(const AProxy: TcuProxy);
+begin
+ FHttpClient.ProxyParams.Clear;
+ FHttpClient.ProxyParams.ProxyServer := AProxy.Host;
+ FHttpClient.ProxyParams.ProxyPort := AProxy.Port;
+ FHttpClient.ProxyParams.ProxyUsername := AProxy.UserName;
+ FHttpClient.ProxyParams.ProxyPassword := AProxy.Password;
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.HttpResponse.pas b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.HttpResponse.pas
new file mode 100644
index 0000000..caa3d14
--- /dev/null
+++ b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.HttpResponse.pas
@@ -0,0 +1,100 @@
+unit CrossUrl.Indy.HttpResponse;
+
+interface
+
+uses
+ CrossUrl.HttpClient,
+ IdHTTP,
+ System.SysUtils,
+ System.Classes;
+
+type
+ TcuHttpResponce = class(TInterfacedObject, IcuHttpResponse)
+ private
+ FResponse: TIdHTTPResponse;
+ FStream: TMemoryStream;
+ function GetStatusCode: Integer;
+ function GetStatusText: string;
+ function GetContentStream: TStream;
+ public
+ constructor Create(AResponse: TIdHTTPResponse; AData: TMemoryStream);
+ function ContentAsString(const AnEncoding: TEncoding = nil): string;
+ property StatusText: string read GetStatusText;
+ property StatusCode: Integer read GetStatusCode;
+ property ContentStream: TStream read GetContentStream;
+ end;
+
+implementation
+
+{ TcuHttpResponce }
+
+function TcuHttpResponce.ContentAsString(const AnEncoding: TEncoding): string;
+var
+ LReader: TStringStream;
+ LCharset: string;
+ LStream: TStream;
+ LFreeLStream: Boolean;
+begin
+ Result := '';
+ LStream := nil;
+ if AnEncoding = nil then
+ begin
+ LCharset := FResponse.CharSet;
+ if (LCharset <> '') and (string.CompareText(LCharset, 'utf-8') <> 0) then // do not translate
+ LReader := TStringStream.Create('', TEncoding.GetEncoding(LCharset), True)
+ else
+ LReader := TStringStream.Create('', TEncoding.UTF8, False);
+ end
+ else
+ LReader := TStringStream.Create('', AnEncoding, False);
+ try
+ {$IFNDEF MACOS} // NSURLConnection automatically decompresses response body.
+ if FResponse.ContentEncoding = 'gzip' then
+ begin
+ // 15 is the default mode.
+ // 16 is to enable gzip mode. http://www.zlib.net/manual.html#Advanced
+ // LStream := TDecompressionStream.Create(FStream, 15 + 16);
+ LFreeLStream := True;
+ end
+ else
+ {$ENDIF}
+ begin
+ LStream := GetContentStream;
+ LFreeLStream := False;
+ end;
+
+ try
+ LReader.CopyFrom(LStream, 0);
+ Result := LReader.DataString;
+ finally
+ if LFreeLStream then
+ LStream.Free;
+ end;
+ finally
+ LReader.Free;
+ end;
+end;
+
+constructor TcuHttpResponce.Create(AResponse: TIdHTTPResponse; AData: TMemoryStream);
+begin
+ FResponse := AResponse;
+ FStream := AData;
+end;
+
+function TcuHttpResponce.GetContentStream: TStream;
+begin
+ Result := FStream //FResponse.ContentStream;
+end;
+
+function TcuHttpResponce.GetStatusCode: Integer;
+begin
+ Result := FResponse.ResponseCode;
+end;
+
+function TcuHttpResponce.GetStatusText: string;
+begin
+ Result := FResponse.ResponseText;
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.MultipartFormData.pas b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.MultipartFormData.pas
new file mode 100644
index 0000000..06d390a
--- /dev/null
+++ b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.MultipartFormData.pas
@@ -0,0 +1,94 @@
+unit CrossUrl.Indy.MultipartFormData;
+
+interface
+
+uses
+ IdMultipartFormData,
+ CrossUrl.HttpClient,
+ System.Classes;
+
+type
+ TcuMultipartFormDataIndy = class(TInterfacedObject, IcuMultipartFormData)
+ private
+ FFormData: TIdMultiPartFormDataStream;
+ public
+ function GetCore: TIdMultiPartFormDataStream;
+ constructor Create;
+ procedure AddField(const AField: string; const AValue: string);
+ procedure AddFile(const AFieldName: string; const AFilePath: string);
+ destructor Destroy; override;
+ function GetStream: TStream;
+ procedure AddStream(const AFieldName: string; Data: TStream; const AFileName:
+ string = '');
+ end;
+
+implementation
+
+uses
+ System.IOUtils,
+ System.SysUtils;
+
+{ TcuMultipartFormDataSysNet }
+
+procedure TcuMultipartFormDataIndy.AddField(const AField, AValue: string);
+begin
+ FFormData.AddFormField(AField, AValue);
+end;
+
+procedure TcuMultipartFormDataIndy.AddFile(const AFieldName, AFilePath: string);
+begin
+ FFormData.AddFile(AFieldName, AFilePath);
+end;
+
+procedure TcuMultipartFormDataIndy.AddStream(const AFieldName: string; Data:
+ TStream; const AFileName: string);
+var
+ LFileStream: TFileStream;
+ LTmpDir: string;
+ LTmpFilename: string;
+begin
+ //get filename for tmp folder e.g. ..\AppData\local\temp\4F353A8AC6AB446D9F592A30B157291B
+ LTmpDir := IncludeTrailingPathDelimiter(TPath.GetTempPath) + TPath.GetGUIDFileName
+ (false);
+ LTmpFilename := IncludeTrailingPathDelimiter(LTmpDir) + ExtractFileName(AFileName);
+ try
+ TDirectory.CreateDirectory(LTmpDir);
+ try
+ LFileStream := TFileStream.Create(LTmpFilename, fmCreate);
+ try
+ LFileStream.CopyFrom(Data, 0);
+ finally
+ LFileStream.Free;
+ end;
+ AddFile(AFieldName, LTmpFilename);
+ finally
+ TFile.Delete(LTmpFilename);
+ end;
+ finally
+ TDirectory.Delete(LTmpDir);
+ end;
+end;
+
+constructor TcuMultipartFormDataIndy.Create;
+begin
+ FFormData := TIdMultiPartFormDataStream.Create;
+end;
+
+destructor TcuMultipartFormDataIndy.Destroy;
+begin
+ FFormData.Free;
+ inherited;
+end;
+
+function TcuMultipartFormDataIndy.GetCore: TIdMultiPartFormDataStream;
+begin
+ Result := FFormData;
+end;
+
+function TcuMultipartFormDataIndy.GetStream: TStream;
+begin
+ result := FFormData;
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.Register.pas b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.Register.pas
new file mode 100644
index 0000000..ab4d6e7
--- /dev/null
+++ b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.Register.pas
@@ -0,0 +1,18 @@
+unit CrossUrl.Indy.Register;
+
+interface
+
+procedure register;
+
+implementation
+
+uses
+ System.Classes,
+ CrossUrl.Indy.HttpClient;
+
+procedure register;
+begin
+ RegisterComponents('CrossUrl', [TcuHttpClientIndy]);
+end;
+
+end.
diff --git a/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.Uri.pas b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.Uri.pas
new file mode 100644
index 0000000..8081000
--- /dev/null
+++ b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.Uri.pas
@@ -0,0 +1,41 @@
+unit CrossUrl.Indy.Uri;
+
+interface
+
+uses
+ IdURI,
+ CrossUrl.HttpClient,
+ System.Classes;
+
+type
+ TcuUriSysNet = class(TInterfacedObject, IcuUri)
+ private
+ FUri: TIdURI;
+ function GetScheme: string;
+ procedure SetScheme(const Value: string);
+ public
+ constructor Create(const AURIStr: string);
+ property Scheme: string read GetScheme write SetScheme;
+ end;
+
+implementation
+
+{ TcuUriSysNet }
+
+constructor TcuUriSysNet.Create(const AURIStr: string);
+begin
+ FUri := TIdURI.Create(AURIStr);
+end;
+
+function TcuUriSysNet.GetScheme: string;
+begin
+ Result := FUri.Protocol;
+end;
+
+procedure TcuUriSysNet.SetScheme(const Value: string);
+begin
+ FUri.Protocol := Value;
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.dpk b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.dpk
new file mode 100644
index 0000000..9c3c7c4
--- /dev/null
+++ b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.dpk
@@ -0,0 +1,43 @@
+package CrossUrl.Indy;
+{$R *.res}
+{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO OFF}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS OFF}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION ON}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO OFF}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES OFF}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$DEFINE RELEASE}
+{$ENDIF IMPLICITBUILDING}
+{$IMPLICITBUILD ON}
+
+requires
+ rtl,
+ IndySystem,
+ IndyProtocols,
+ IndyCore,
+ CrossUrl;
+
+contains
+ CrossUrl.Indy.HttpClient in 'CrossUrl.Indy.HttpClient.pas',
+ CrossUrl.Indy.HttpResponse in 'CrossUrl.Indy.HttpResponse.pas',
+ CrossUrl.Indy.MultipartFormData in 'CrossUrl.Indy.MultipartFormData.pas',
+ CrossUrl.Indy.Register in 'CrossUrl.Indy.Register.pas',
+ CrossUrl.Indy.Uri in 'CrossUrl.Indy.Uri.pas';
+
+end.
diff --git a/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.dproj b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.dproj
new file mode 100644
index 0000000..1c0c917
--- /dev/null
+++ b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.dproj
@@ -0,0 +1,1044 @@
+
+
+ {736CEA6E-0CB3-4907-A696-8704727F2301}
+ CrossUrl.Indy.dpk
+ 19.4
+ None
+ True
+ Release
+ Win32
+ 1
+ Package
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ .\$(Platform)\$(Config)
+ .\$(Platform)\$(Config)
+ false
+ false
+ false
+ false
+ false
+ true
+ true
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ All
+ CrossUrl_Indy
+ ..\Core;$(DCC_UnitSearchPath)
+ 1049
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ true
+
+
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ Debug
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar
+
+
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ Debug
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri;ITSAppUsesNonExemptEncryption=false;NSBluetoothAlwaysUsageDescription=The reason for accessing bluetooth;NSBluetoothPeripheralUsageDescription=The reason for accessing bluetooth peripherals;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSMotionUsageDescription=The reason for accessing the accelerometer;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ iPhoneAndiPad
+ true
+ Debug
+ $(MSBuildProjectName)
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ Debug
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ Debug
+ true
+ Base
+ true
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+ rtl;IndySystem;IndyProtocols;IndyCore;CrossUrl.SystemNet;CrossUrl;$(DCC_UsePackage)
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ Debug
+ true
+ 1033
+
+
+ DEBUG;$(DCC_Define)
+ true
+ false
+ true
+ true
+ true
+
+
+ false
+ true
+ 1033
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+
+ MainSource
+
+
+
+
+
+
+
+
+
+
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+ Cfg_2
+ Base
+
+
+
+ Delphi.Personality.12
+ Package
+
+
+
+ CrossUrl.Indy.dpk
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ CrossUrl_Indy.bpl
+ true
+
+
+
+
+ 1
+
+
+ 0
+
+
+
+
+ classes
+ 64
+
+
+ classes
+ 64
+
+
+
+
+ classes
+ 1
+
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+ res\xml
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+ .framework
+
+
+ 1
+ .framework
+
+
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+
diff --git a/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.res b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.res
new file mode 100644
index 0000000..cd89ce6
Binary files /dev/null and b/v1.4.4/CrossUrl/Indy/CrossUrl.Indy.res differ
diff --git a/v1.4.4/CrossUrl/LICENSE b/v1.4.4/CrossUrl/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/v1.4.4/CrossUrl/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/v1.4.4/CrossUrl/README.md b/v1.4.4/CrossUrl/README.md
new file mode 100644
index 0000000..3206dfc
--- /dev/null
+++ b/v1.4.4/CrossUrl/README.md
@@ -0,0 +1,4 @@
+# CrossUrl
+Biblioteca para usar bibliotecas de rede do usuário final.
+
+**Installing and other info: see [wiki-page](https://github.com/ms301/CrossUrl/wiki)**
diff --git a/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.HttpClient.pas b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.HttpClient.pas
new file mode 100644
index 0000000..6841ffc
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.HttpClient.pas
@@ -0,0 +1,79 @@
+unit CrossUrl.SystemNet.HttpClient;
+
+interface
+
+uses
+ CrossUrl.HttpClient,
+ System.Classes,
+ System.Net.HttpClient;
+
+type
+ TcuHttpClientSysNet = class(TComponent, IcuHttpClient)
+ private
+ FHttpClient: THTTPClient;
+ function GetProxy: TcuProxy;
+ procedure SetProxy(const AProxy: TcuProxy);
+ public
+ destructor Destroy; override;
+ function Get(const AURL: string): IcuHttpResponse;
+ function Post(const AURL: string; const ASource: IcuMultipartFormData):
+ IcuHttpResponse;
+ function CreateMultipartFormData: IcuMultipartFormData;
+ constructor Create(AOwner: TComponent); override;
+ property Proxy: TcuProxy read GetProxy write SetProxy;
+ end;
+
+implementation
+
+uses
+ CrossUrl.SystemNet.HttpResponse,
+ CrossUrl.SystemNet.MultipartFormData,
+ System.Net.URLClient;
+
+{ TcuHttpClient }
+
+constructor TcuHttpClientSysNet.Create(AOwner: TComponent);
+begin
+ inherited;
+ FHttpClient := THTTPClient.Create;
+end;
+
+function TcuHttpClientSysNet.CreateMultipartFormData: IcuMultipartFormData;
+begin
+ Result := TcuMultipartFormDataSysNet.Create;
+end;
+
+destructor TcuHttpClientSysNet.Destroy;
+begin
+ FHttpClient.Free;
+ inherited Destroy;
+end;
+
+function TcuHttpClientSysNet.Get(const AUrl: string): IcuHttpResponse;
+begin
+ Result := TcuHttpResponce.Create(FHttpClient.Get(AUrl));
+end;
+
+function TcuHttpClientSysNet.GetProxy: TcuProxy;
+begin
+ Result.Host := FHttpClient.ProxySettings.Host;
+ Result.Port := FHttpClient.ProxySettings.Port;
+ Result.UserName := FHttpClient.ProxySettings.UserName;
+ Result.Password := FHttpClient.ProxySettings.Password;
+end;
+
+function TcuHttpClientSysNet.Post(const AURL: string; const ASource:
+ IcuMultipartFormData): IcuHttpResponse;
+begin
+ Result := TcuHttpResponce.Create(FHttpClient.Post(AURL, (ASource as
+ TcuMultipartFormDataSysNet).GetCore));
+end;
+
+procedure TcuHttpClientSysNet.SetProxy(const AProxy: TcuProxy);
+begin
+ FHttpClient.ProxySettings := TProxySettings.Create(AProxy.Host, AProxy.Port,
+ AProxy.UserName, AProxy.Password);
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.HttpResponse.pas b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.HttpResponse.pas
new file mode 100644
index 0000000..9f91cb1
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.HttpResponse.pas
@@ -0,0 +1,56 @@
+unit CrossUrl.SystemNet.HttpResponse;
+
+interface
+
+uses
+ System.Net.HttpClient,
+ CrossUrl.HttpClient,
+ System.SysUtils,
+ System.Classes;
+
+type
+ TcuHttpResponce = class(TInterfacedObject, IcuHttpResponse)
+ private
+ FHttpResponse: IHTTPResponse;
+ function GetStatusCode: Integer;
+ function GetStatusText: string;
+ function GetContentStream: TStream;
+ public
+ constructor Create(AHttpResponse: IHTTPResponse);
+ function ContentAsString(const AnEncoding: TEncoding = nil): string;
+ property StatusText: string read GetStatusText;
+ property StatusCode: Integer read GetStatusCode;
+ property ContentStream: TStream read GetContentStream;
+ end;
+
+implementation
+
+{ TcuHttpResponce }
+
+function TcuHttpResponce.ContentAsString(const AnEncoding: TEncoding): string;
+begin
+ Result := FHttpResponse.ContentAsString(AnEncoding);
+end;
+
+constructor TcuHttpResponce.Create(AHttpResponse: IHTTPResponse);
+begin
+ FHttpResponse := AHttpResponse;
+end;
+
+function TcuHttpResponce.GetContentStream: TStream;
+begin
+ Result := FHttpResponse.ContentStream;
+end;
+
+function TcuHttpResponce.GetStatusCode: Integer;
+begin
+ Result := FHttpResponse.StatusCode;
+end;
+
+function TcuHttpResponce.GetStatusText: string;
+begin
+ Result := FHttpResponse.StatusText;
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.MultipartFormData.pas b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.MultipartFormData.pas
new file mode 100644
index 0000000..13db496
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.MultipartFormData.pas
@@ -0,0 +1,94 @@
+unit CrossUrl.SystemNet.MultipartFormData;
+
+interface
+
+uses
+ System.Net.Mime,
+ CrossUrl.HttpClient,
+ System.Classes;
+
+type
+ TcuMultipartFormDataSysNet = class(TInterfacedObject, IcuMultipartFormData)
+ private
+ FFormData: TMultipartFormData;
+ public
+ function GetCore: TMultipartFormData;
+ constructor Create;
+ procedure AddField(const AField: string; const AValue: string);
+ procedure AddFile(const AFieldName: string; const AFilePath: string);
+ destructor Destroy; override;
+ procedure AddStream(const AFieldName: string; Data: TStream; const AFileName:
+ string = '');
+ function GetStream: TStream;
+ end;
+
+implementation
+
+uses
+ System.IOUtils,
+ System.SysUtils;
+
+{ TcuMultipartFormData }
+
+procedure TcuMultipartFormDataSysNet.AddField(const AField, AValue: string);
+begin
+ FFormData.AddField(AField, AValue);
+end;
+
+procedure TcuMultipartFormDataSysNet.AddFile(const AFieldName, AFilePath: string);
+begin
+ FFormData.AddFile(AFieldName, AFilePath);
+end;
+
+procedure TcuMultipartFormDataSysNet.AddStream(const AFieldName: string; Data:
+ TStream; const AFileName: string);
+var
+ LFileStream: TFileStream;
+ LTmpDir: string;
+ LTmpFilename: string;
+begin
+ // get filename for tmp folder e.g. ..\AppData\local\temp\4F353A8AC6AB446D9F592A30B157291B
+ LTmpDir := IncludeTrailingPathDelimiter(TPath.GetTempPath) + TPath.GetGUIDFileName
+ (false);
+ LTmpFilename := IncludeTrailingPathDelimiter(LTmpDir) + ExtractFileName(AFileName);
+ try
+ TDirectory.CreateDirectory(LTmpDir);
+ try
+ LFileStream := TFileStream.Create(LTmpFilename, fmCreate);
+ try
+ LFileStream.CopyFrom(Data, 0);
+ finally
+ LFileStream.Free;
+ end;
+ AddFile(AFieldName, LTmpFilename);
+ finally
+ TFile.Delete(LTmpFilename);
+ end;
+ finally
+ TDirectory.Delete(LTmpDir);
+ end;
+end;
+
+constructor TcuMultipartFormDataSysNet.Create;
+begin
+ FFormData := TMultipartFormData.Create;
+end;
+
+destructor TcuMultipartFormDataSysNet.Destroy;
+begin
+ FFormData.Free;
+ inherited;
+end;
+
+function TcuMultipartFormDataSysNet.GetCore: TMultipartFormData;
+begin
+ Result := FFormData;
+end;
+
+function TcuMultipartFormDataSysNet.GetStream: TStream;
+begin
+ Result := FFormData.Stream;
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.Register.pas b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.Register.pas
new file mode 100644
index 0000000..6b777fb
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.Register.pas
@@ -0,0 +1,19 @@
+unit CrossUrl.SystemNet.Register;
+
+interface
+
+procedure register;
+
+implementation
+
+uses
+ System.Classes,
+ CrossUrl.SystemNet.HttpClient;
+
+procedure register;
+begin
+ RegisterComponents('CrossUrl', [TcuHttpClientSysNet]);
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.Uri.pas b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.Uri.pas
new file mode 100644
index 0000000..bb6c5ac
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.Uri.pas
@@ -0,0 +1,41 @@
+unit CrossUrl.SystemNet.Uri;
+
+interface
+
+uses
+ System.Net.URLClient,
+ CrossUrl.HttpClient,
+ System.Classes;
+
+type
+ TcuUriSysNet = class(TInterfacedObject, IcuUri)
+ private
+ FUri: TURI;
+ function GetScheme: string;
+ procedure SetScheme(const Value: string);
+ public
+ constructor Create(const AURIStr: string);
+ property Scheme: string read GetScheme write SetScheme;
+ end;
+
+implementation
+
+{ TcuUriSysNet }
+
+constructor TcuUriSysNet.Create(const AURIStr: string);
+begin
+ FUri := turi.Create(AURIStr);
+end;
+
+function TcuUriSysNet.GetScheme: string;
+begin
+ Result := FUri.Scheme;
+end;
+
+procedure TcuUriSysNet.SetScheme(const Value: string);
+begin
+ FUri.Scheme := Value;
+end;
+
+end.
+
diff --git a/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.dpk b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.dpk
new file mode 100644
index 0000000..880ae78
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.dpk
@@ -0,0 +1,41 @@
+package CrossUrl.SystemNet;
+{$R *.res}
+{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO OFF}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS OFF}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION ON}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO OFF}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES OFF}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$DEFINE RELEASE}
+{$ENDIF IMPLICITBUILDING}
+{$DESCRIPTION 'Cross URL - SystemNet'}
+{$IMPLICITBUILD ON}
+
+requires
+ rtl,
+ CrossUrl;
+
+contains
+ CrossUrl.SystemNet.Uri in 'CrossUrl.SystemNet.Uri.pas',
+ CrossUrl.SystemNet.Register in 'CrossUrl.SystemNet.Register.pas',
+ CrossUrl.SystemNet.MultipartFormData in 'CrossUrl.SystemNet.MultipartFormData.pas',
+ CrossUrl.SystemNet.HttpResponse in 'CrossUrl.SystemNet.HttpResponse.pas',
+ CrossUrl.SystemNet.HttpClient in 'CrossUrl.SystemNet.HttpClient.pas';
+
+end.
diff --git a/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.dproj b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.dproj
new file mode 100644
index 0000000..d2da4a1
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.dproj
@@ -0,0 +1,1039 @@
+
+
+ {F04A0510-3390-4D30-AAD7-DF356290AA6F}
+ CrossUrl.SystemNet.dpk
+ 19.4
+ None
+ True
+ Release
+ Win32
+ 1
+ Package
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ .\$(Platform)\$(Config)
+ .\$(Platform)\$(Config)
+ false
+ false
+ false
+ false
+ false
+ true
+ true
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ All
+ CrossUrl_SystemNet
+ ..\Core;$(DCC_UnitSearchPath)
+ 1033
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+
+
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ Debug
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar
+
+
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ Debug
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri;ITSAppUsesNonExemptEncryption=false;NSBluetoothAlwaysUsageDescription=The reason for accessing bluetooth;NSBluetoothPeripheralUsageDescription=The reason for accessing bluetooth peripherals;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSMotionUsageDescription=The reason for accessing the accelerometer;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ iPhoneAndiPad
+ true
+ Debug
+ $(MSBuildProjectName)
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ Debug
+
+
+ CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers
+ Debug
+ true
+ Base
+ true
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+ rtl;CrossUrl.Indy;CrossUrl;$(DCC_UsePackage)
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ Debug
+ true
+
+
+ DEBUG;$(DCC_Define)
+ true
+ false
+ true
+ true
+ true
+
+
+ false
+ true
+ 1033
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+
+ MainSource
+
+
+
+
+
+
+
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+ Cfg_2
+ Base
+
+
+
+ Delphi.Personality.12
+ Package
+
+
+
+ CrossUrl.SystemNet.dpk
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ CrossUrl_SystemNet.bpl
+ true
+
+
+
+
+ 1
+
+
+ 0
+
+
+
+
+ classes
+ 64
+
+
+ classes
+ 64
+
+
+
+
+ classes
+ 1
+
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+ res\xml
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+ .framework
+
+
+ 1
+ .framework
+
+
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
+
diff --git a/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.res b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.res
new file mode 100644
index 0000000..822f0fa
Binary files /dev/null and b/v1.4.4/CrossUrl/System.Net/CrossUrl.SystemNet.res differ
diff --git a/v1.4.4/CrossUrl/System.Net/Demo.dpr b/v1.4.4/CrossUrl/System.Net/Demo.dpr
new file mode 100644
index 0000000..ec3c9c1
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/Demo.dpr
@@ -0,0 +1,19 @@
+program Demo;
+
+{$APPTYPE CONSOLE}
+
+{$R *.res}
+
+uses
+ CrossUrl.HttpClient,
+ System.SysUtils;
+
+begin
+ try
+ { TODO -oUser -cConsole Main : Insert code here }
+ except
+ on E: Exception do
+ Writeln(E.ClassName, ': ', E.Message);
+ end;
+end.
+
diff --git a/v1.4.4/CrossUrl/System.Net/Demo.dproj b/v1.4.4/CrossUrl/System.Net/Demo.dproj
new file mode 100644
index 0000000..93a71c4
--- /dev/null
+++ b/v1.4.4/CrossUrl/System.Net/Demo.dproj
@@ -0,0 +1,581 @@
+
+
+ {86147BCA-AD6D-4187-BEC5-50AE4F61A79E}
+ 18.4
+ None
+ Demo.dpr
+ True
+ Debug
+ Win32
+ 1
+ Console
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ .\$(Platform)\$(Config)
+ .\$(Platform)\$(Config)
+ false
+ false
+ false
+ false
+ false
+ RESTComponents;emsclientfiredac;DataSnapFireDAC;FireDACIBDriver;emsclient;FireDACCommon;RESTBackendComponents;soapserver;CloudService;FireDACCommonDriver;inet;FireDAC;FireDACSqliteDriver;soaprtl;soapmidas;$(DCC_UsePackage)
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ Demo
+ ..\Core;..\Indy;..\System.Net;$(DCC_UnitSearchPath)
+ 1049
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+
+
+ DBXSqliteDriver;DBXInterBaseDriver;tethering;bindcompfmx;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;ibmonitor;DbxCommonDriver;ibxpress;xmlrtl;DataSnapNativeClient;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar
+
+
+ DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;emsedge;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;emshosting;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;ibxpress;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;ObjectDebugger10Seattle;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+ true
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+
+
+ DEBUG;$(DCC_Define)
+ true
+ false
+ true
+ true
+ true
+
+
+ false
+ 1033
+ C:\Users\Максим\Documents\Embarcadero\Studio\Projects\(None)
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+
+ MainSource
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+ Delphi.Personality.12
+ Application
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+ Demo.dpr
+
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ Demo.exe
+ true
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ Contents\MacOS
+ 0
+
+
+
+
+ classes
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ Contents\MacOS
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ Contents\Resources\StartUp\
+ 0
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\
+ 1
+
+
+ ..\
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\
+ 1
+
+
+
+
+ Contents
+ 1
+
+
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ True
+
+
+ 12
+
+
+
+
+
diff --git a/v1.4.4/Exemplo/ExemplosTInjectTelegram.dpr b/v1.4.4/Exemplo/ExemplosTInjectTelegram.dpr
new file mode 100644
index 0000000..75ceee5
--- /dev/null
+++ b/v1.4.4/Exemplo/ExemplosTInjectTelegram.dpr
@@ -0,0 +1,15 @@
+program ExemplosTInjectTelegram;
+uses
+ Vcl.Forms,
+ uPrincipal in 'uPrincipal.pas' {Form1},
+ uResourceString in 'uResourceString.pas',
+ XSuperJSON in 'XSuperJSON.pas',
+ XSuperObject in 'XSuperObject.pas';
+
+{$R *.res}
+begin
+ Application.Initialize;
+ Application.MainFormOnTaskbar := True;
+ Application.CreateForm(TForm1, Form1);
+ Application.Run;
+end.
diff --git a/v1.4.4/Exemplo/ExemplosTInjectTelegram.dproj b/v1.4.4/Exemplo/ExemplosTInjectTelegram.dproj
new file mode 100644
index 0000000..dd7876f
--- /dev/null
+++ b/v1.4.4/Exemplo/ExemplosTInjectTelegram.dproj
@@ -0,0 +1,1109 @@
+
+
+ {3F3B4088-78E3-456E-8B27-FEF37FD14424}
+ 19.4
+ VCL
+ ExemplosTInjectTelegram.dpr
+ True
+ Debug
+ Win64
+ 3
+ Application
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ .\$(Platform)\$(Config)
+ .\$(Platform)\$(Config)
+ false
+ false
+ false
+ false
+ false
+ System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+ ExemplosTInjectTelegram
+ true
+
+
+ DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;inetdb;CEF4Delphi;FmxTeeUI;emsedge;FireDACIBDriver;fmx;fmxdae;CrossUrl.Indy;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;TInjectCollection;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;CrossUrl;emshosting;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;FireDACTDataDriver;DBXOdbcDriver;FMXTee;soaprtl;DbxCommonDriver;CrossUrl.SystemNet;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;emsserverresource;DbxClientDriver;FireDACDSDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;TInjectTelegramGestorCollection;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;TInjectTelegramCollection;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+ $(BDS)\bin\default_app.manifest
+
+
+ DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;CEF4Delphi;FmxTeeUI;emsedge;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;FireDACTDataDriver;DBXOdbcDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;emsserverresource;DbxClientDriver;FireDACDSDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+ $(BDS)\bin\default_app.manifest
+
+
+ DEBUG;$(DCC_Define)
+ true
+ false
+ true
+ true
+ true
+
+
+ false
+ true
+ PerMonitorV2
+
+
+ true
+ PerMonitorV2
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+ true
+ PerMonitorV2
+
+
+ true
+ PerMonitorV2
+
+
+
+ MainSource
+
+
+
+ dfm
+
+
+
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+ Cfg_2
+ Base
+
+
+
+ Delphi.Personality.12
+ Application
+
+
+
+ ExemplosTInjectTelegram.dpr
+
+
+ $00000416
+ ITA
+
+
+ Espanhol (Bolívia)*$0000400A*ESB*ESB
+ Francês (França)*$0000040C*FRA*FRA
+ Hebraico (Israel)*$0000040D*HEB*HEB
+ Inglês (Estados Unidos)*$00000409*ENU*ENU
+ Italiano (Itália)*$00000410*ITA*ITA
+ Persa (Irã)*$00000429*FAR*FAR
+ Russo (Rússia)*$00000419*RUS*RUS
+ Russo (Moldova)*$00000819*RUM*RUM
+
+
+ uPrincipal.dfm
+ Win32\Debug\ExemplosTInjectTelegram.drc
+
+
+
+
+
+ ExemplosTInjectTelegram.exe
+ true
+
+
+
+
+ ExemplosTInjectTelegram.exe
+ true
+
+
+
+
+ ExemplosTInjectTelegram.rsm
+ true
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ classes
+ 64
+
+
+ classes
+ 64
+
+
+
+
+ classes
+ 1
+
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+ res\xml
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ Contents\MacOS
+ 1
+ .framework
+
+
+ Contents\MacOS
+ 1
+ .framework
+
+
+ Contents\MacOS
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ Contents\Resources\StartUp\
+ 0
+
+
+ Contents\Resources\StartUp\
+ 0
+
+
+ Contents\Resources\StartUp\
+ 0
+
+
+ 0
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\
+ 1
+
+
+ ..\
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+ ..\
+ 1
+
+
+ ..\
+ 1
+
+
+ ..\
+ 1
+
+
+
+
+ Contents
+ 1
+
+
+ Contents
+ 1
+
+
+ Contents
+ 1
+
+
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+
+
+ 12
+
+
+
+
+
diff --git a/v1.4.4/Exemplo/ExemplosTInjectTelegram.res b/v1.4.4/Exemplo/ExemplosTInjectTelegram.res
new file mode 100644
index 0000000..df29309
Binary files /dev/null and b/v1.4.4/Exemplo/ExemplosTInjectTelegram.res differ
diff --git a/v1.4.4/Exemplo/Win64/Debug/Chats/1042366601/file_74.jpg b/v1.4.4/Exemplo/Win64/Debug/Chats/1042366601/file_74.jpg
new file mode 100644
index 0000000..1fab9c4
Binary files /dev/null and b/v1.4.4/Exemplo/Win64/Debug/Chats/1042366601/file_74.jpg differ
diff --git a/v1.4.4/Exemplo/XSuperJSON.pas b/v1.4.4/Exemplo/XSuperJSON.pas
new file mode 100644
index 0000000..bd50f5f
--- /dev/null
+++ b/v1.4.4/Exemplo/XSuperJSON.pas
@@ -0,0 +1,2368 @@
+ (*
+ * XSuperObject - Simple JSON Framework
+ *
+ * The MIT License (MIT)
+ * Copyright (c) 2015 Onur YILDIZ
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
+ * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *)
+
+unit XSuperJSON;
+
+interface
+
+uses
+ SysUtils, Classes, Generics.Collections, Generics.Defaults, Math, DateUtils,
+ {$IFDEF FPC}RegEx{$ELSE}RegularExpressions{$ENDIF}, RTTI;
+
+
+const
+ CNull = 'null';
+ MaxCHR = #127;
+
+ Err_UnexpectedEndOfInput = 'Unexpected end of input';
+ Err_Expected = 'Expected %s';
+ Err_ExpectedButFound = '"%s" expected but "%s" found';
+ Err_UnexpectedTokenILLEGAL = 'Unexpected token ILLEGAL';
+
+type
+
+ // ## Forward Declarations
+ // -----------------------
+
+ TJSONNull = class;
+ TLexGenerator = class;
+ TRoute = class;
+ PPosition = ^TPosition;
+ TPosition = record
+ Col: Integer;
+ Line: Integer;
+ end;
+
+ TDataType = (dtNil, dtNull, dtObject, dtArray, dtString, dtInteger, dtFloat, dtBoolean, dtDateTime, dtDate, dtTime);
+ TJSONComparison = {$IFDEF FPC} function(Left, Right: T): Integer{$ELSE}reference to function(Left, Right: T): Integer{$ENDIF};
+ // ## Exception
+
+ TJSONSyntaxError = class(Exception)
+ public
+ constructor Create(const Msg: String; Pos: PPosition);
+ constructor CreateFmt(const Msg: String; const Args: array of TVarRec; Pos: PPosition);
+ end;
+
+ // ## JSONWriter
+ TJSONWriter = class
+ public const
+ IDENT_SIZE = 2;
+ private
+ FData: TStringBuilder;
+ FIdent: Boolean;
+ FIdentOffset: Integer;
+ FUniversalTime: Boolean;
+ public
+ constructor Create(const useIdent, useUniversalTime: Boolean);
+ destructor Destroy; override;
+ procedure Inc;
+ procedure Dec;
+
+ function Append(const Value: string; const CRLF: Boolean = False): TJSONWriter; overload;
+ function Append(const Value: int64; const CRLF: Boolean = False): TJSONWriter; overload;
+ function AppendVal(const Value: string; const CRLF: Boolean = False): TJSONWriter; overload;
+ function AppendVal(const Value: int64; const CRLF: Boolean = False): TJSONWriter; overload;
+ function ToString: string; {$IFNDEF FPC}override;{$ENDIF}
+
+ property Ident: Boolean read FIdent;
+ property UniversalTime: Boolean read FUniversalTime;
+ end;
+
+
+ // ## JSON Symbols
+ // ---------------
+
+ IJSONAncestor = interface
+ ['{FFB71762-50A1-4D27-9F59-56F6208421C7}']
+ function GetAsVariant: Variant;
+ procedure SetAsVariant(const Value: Variant);
+ function GetDataType: TDataType;
+ function GetIsNull: Boolean;
+ procedure AsJSONString(Str: TJSONWriter);
+ property IsNull: Boolean read GetIsNull;
+ property DataType: TDataType read GetDataType;
+ property AsVariant: Variant read GetAsVariant write SetAsVariant;
+ end;
+
+ TJSONAncestor = class abstract(TInterfacedObject, IJSONAncestor)
+ private
+ function GetAsVariant: Variant;
+ procedure SetAsVariant(const Value: Variant);
+ protected
+ function GetDataType: TDataType; virtual;
+ function GetIsNull: Boolean; virtual;
+ public
+ procedure AsJSONString(Str: TJSONWriter); virtual;
+ property IsNull: Boolean read GetIsNull;
+ property DataType: TDataType read GetDataType;
+ property AsVariant: Variant read GetAsVariant write SetAsVariant;
+ end;
+
+ IJSONValue = interface(IJSONAncestor)
+ ['{0B1ED53C-EF62-4BFA-9E78-9DD9088D96C5}']
+ function GetData: T;
+ procedure SetData(const Value: T);
+ procedure SetNull;
+ property Value: T read GetData write SetData;
+ end;
+
+ TJSONValue = class abstract(TJSONAncestor, IJSONValue)
+ public
+ FNull: Boolean;
+ FData: T;
+ protected
+ function GetData: T; virtual;
+ procedure SetData(const Value: T); virtual;
+ function GetIsNull: Boolean; override;
+ property Value: T read GetData write SetData;
+ public
+ constructor Create(const Value: T);
+ constructor CreateNull;
+ procedure SetNull;
+ end;
+
+ IJSONNull = interface(IJSONValue)['{C19F5715-B832-46D8-8668-1A9DC31393D7}']end;
+ TJSONNull = class(TJSONValue, IJSONNull)
+ public
+ procedure AsJSONString(Str: TJSONWriter); override;
+ protected
+ function GetIsNull: Boolean; override;
+ end;
+
+ IJSONBoolean = interface(IJSONValue)['{CCC8D8C5-081D-4DCF-93DB-CC0696458A12}']end;
+ TJSONBoolean = class(TJSONValue, IJSONBoolean)
+ public
+ procedure AsJSONString(Str: TJSONWriter); override;
+ property Value;
+ end;
+
+ IJSONString = interface(IJSONValue)['{C507BB41-3674-4F47-8D6B-5605258F6A2F}']end;
+ TJSONString = class(TJSONValue, IJSONString)
+ public
+ procedure AsJSONString(Str: TJSONWriter); override;
+ property Value;
+ end;
+
+ IJSONRaw = interface(IJSONString)['{EF5EF422-1A81-49EA-A3E0-9E7D5B5CC1E2}']end;
+ TJSONRaw = class(TJSONString, IJSONRaw)
+ public
+ procedure AsJSONString(Str: TJSONWriter); override;
+ property Value;
+ end;
+
+ IJSONInteger = interface(IJSONValue)['{E9D84348-9634-40F5-8A1F-FF006F45FC6D}']end;
+ TJSONInteger = class(TJSONValue, IJSONInteger)
+ public
+ procedure AsJSONString(Str: TJSONWriter); override;
+ property Value;
+ end;
+
+ IJSONFloat = interface(IJSONValue)['{29D840FB-191B-4304-9518-C2937B3AE6B0}']end;
+ TJSONFloat = class(TJSONValue, IJSONFloat)
+ public
+ procedure AsJSONString(Str: TJSONWriter); override;
+ property Value;
+ end;
+
+ IJSONBaseDate = interface(IJSONValue)
+ ['{7ACB3D47-A9A6-49C1-AFF3-F451368EAE48}']
+ function GetAsString: String;
+ property AsString: String read GetAsString;
+ end;
+
+ TJSONBaseDate = class(TJSONValue, IJSONBaseDate)
+ protected
+ FFormat: String;
+ public
+ function GetAsString: String;
+ procedure AsJSONString(Str: TJSONWriter); override;
+ end;
+
+ IJSONDateTime = interface(IJSONBaseDate)['{9441CA2E-B822-4C13-ABF0-15F8026CCE50}']end;
+ TJSONDateTime = class(TJSONBaseDate, IJSONDateTime)
+ public
+ constructor Create(const Value: TDateTime; const Format: String = 'yyyy-mm-dd"T"hh":"mm":"ss.zzz');
+ property Value;
+ end;
+
+ IJSONDate = interface(IJSONBaseDate)['{A862D6A5-2C4A-41CD-B2C0-F7B58FA14066}']end;
+ TJSONDate = class(TJSONBaseDate, IJSONDate)
+ public
+ constructor Create(const Value: TDate; const Format: String = 'yyyy-mm-dd');
+ property Value;
+ end;
+
+ IJSONTime = interface(IJSONBaseDate)['{EEBCD145-B837-4129-A21D-378DF7DA53B2}']end;
+ TJSONTime = class(TJSONBaseDate, IJSONTime)
+ public
+ constructor Create(const Value: TTime; const Format: String = 'hh":"mm":"ss.zzz');
+ property Value;
+ end;
+
+
+ TJSONDateTimeCheckCallBack = {$IFDEF FPC} function(Str: String; var Value: TDateTime; var Typ: TDataType): Boolean{$ELSE}reference to function(Str: String; var Value: TDateTime; var Typ: TDataType): Boolean{$ENDIF};
+ TJSONDateManager = class
+ private
+ class var FFormats: TList;
+ class function GetFormats: TList; static; inline;
+ public
+ class constructor Create;
+ class destructor Destroy;
+ class function Check(const Data: String; var AValue: TDateTime; var Typ: TDataType): Boolean;
+ class property Formats: TList read GetFormats;
+ end;
+
+ IJSONPair = interface
+ ['{D328943F-5ED1-4B35-8332-573156565C96}']
+ function GetName: String;
+ function GetValue: IJSONAncestor;
+ procedure SetName(const Value: String);
+ procedure SetValue(const Value: IJSONAncestor);
+ property Name: String read GetName write SetName;
+ property JSONValue: IJSONAncestor read GetValue write SetValue;
+ end;
+
+ TJSONPair = class(TInterfacedObject, IJSONPair)
+ private
+ FName: String;
+ FValue: IJSONAncestor;
+ function GetName: String;
+ function GetValue: IJSONAncestor;
+ procedure SetName(const Value: String);
+ procedure SetValue(const Value: IJSONAncestor);
+ public
+ constructor Create(const aName: String; aValue: IJSONAncestor);
+ destructor Destroy; override;
+ property Name: String read GetName write SetName;
+ property JSONValue: IJSONAncestor read GetValue write SetValue;
+ end;
+
+ TJSONEnumerator = record
+ Index : Integer;
+ List : TList;
+ function MoveNext : Boolean;
+ function GetCurrent : T;
+ property Current : T read GetCurrent;
+ end;
+
+ IJSONObject = Interface(IJSONValue)
+ ['{2A9244EC-F202-4CC1-9F89-7DA12437F7ED}']
+ function Count: Integer;
+ function Get(const Name: String): IJSONPair; overload;
+ function Get(const Index: Integer): IJSONPair; overload;
+ procedure AddPair(P: IJSONPair); overload;
+ procedure AddPair(Name: String; Value: IJSONAncestor); overload;
+ procedure Remove(P: IJSONPair); overload;
+ procedure Remove(const Name: String); overload;
+ procedure Remove(const Index: Integer); overload;
+ function GetEnumerator: TJSONEnumerator;
+ procedure Sort(Comparison: TJSONComparison);
+ end;
+
+
+ TJSONObject = class(TJSONValue, IJSONObject)
+ private
+ FPairList: TList;
+ FNull: Boolean;
+ protected
+ function GetIsNull: Boolean; override;
+ public
+ constructor Create;
+ destructor Destroy; override;
+ function Count: Integer;
+ function Get(const Name: String): IJSONPair; overload;
+ function Get(const Index: Integer): IJSONPair; overload;
+ procedure AsJSONString(Str: TJSONWriter); override;
+ procedure AddPair(P: IJSONPair); overload;
+ procedure AddPair(Name: String; Value: IJSONAncestor); overload; inline;
+ procedure Remove(P: IJSONPair); overload; inline;
+ procedure Remove(const Name: String); overload;
+ procedure Remove(const Index: Integer); overload;
+ function GetEnumerator: TJSONEnumerator;
+ procedure Sort(Comparison: TJSONComparison);
+ class function ParseJSONValue(const Str: String; const CheckDate: Boolean): IJSONAncestor;
+ end;
+
+ IJSONArray = interface(IJSONValue)
+ ['{C63B4323-6D7E-4151-BA1B-4C55CDE28FDB}']
+ procedure Add(Val: IJSONAncestor);
+ procedure Remove(Val: IJSONAncestor); overload;
+ procedure Remove(Index: Integer); overload;
+ procedure Clear;
+ function Count: Integer;
+ function Get(const I: Integer): IJSONAncestor;
+ procedure SetIndex(const Int: Integer; const Value: IJSONAncestor);
+ function GetEnumerator: TJSONEnumerator;
+ procedure Sort(Comparison: TJSONComparison);
+ property Index[const Int: Integer]: IJSONAncestor read Get write SetIndex; default;
+ end;
+
+ TJSONArray = class(TJSONValue, IJSONArray)
+ private
+ FList: TList;
+ FNull: Boolean;
+ procedure SetIndex(const Int: Integer; const Value: IJSONAncestor);
+ protected
+ function GetIsNull: Boolean; override;
+ public
+ constructor Create;
+ destructor Destroy; override;
+ procedure AsJSONString(Str: TJSONWriter); override;
+ procedure Add(Val: IJSONAncestor);
+ procedure Remove(Val: IJSONAncestor); overload;
+ procedure Remove(Index: Integer); overload;
+ procedure Clear;
+ function Count: Integer;
+ function Get(const I: Integer): IJSONAncestor;
+ function GetEnumerator: TJSONEnumerator;
+ procedure Sort(Comparison: TJSONComparison);
+ property Index[const Int: Integer]: IJSONAncestor read Get write SetIndex; default;
+ end;
+
+
+ TJSONBuilder = class
+ private
+ LGen: TLexGenerator;
+ FCheckDates: Boolean;
+ public
+ constructor Create(const JSON: String; const CheckDates: Boolean);
+ destructor Destroy; override;
+ function ReadValue: IJSONAncestor;
+ procedure ReadString(var Val: IJSONAncestor);
+ procedure ReadInteger(var Val: IJSONAncestor);
+ procedure ReadFloat(var Val: IJSONAncestor);
+ procedure ReadObject(var Val: IJSONAncestor);
+ procedure ReadTrue(var Val: IJSONAncestor);
+ procedure ReadFalse(var Val: IJSONAncestor);
+ procedure ReadNull(var Val: IJSONAncestor);
+ procedure ReadArray(var Val: IJSONAncestor);
+ end;
+
+ TJSONInterpreter = class
+ private
+ LGen: TLexGenerator;
+ FJSON: IJSONAncestor;
+ FExceptionBlock: Boolean;
+ function ReadName(Base: IJSONAncestor): IJSONAncestor;
+ function ReadArrayIndex(Base: IJSONArray): IJSONAncestor;
+ function ReadObject(Base: IJSONAncestor): IJSONObject;
+ function ReadArray(Base: IJSONAncestor): IJSONArray;
+ function ReadValue(Base: IJSONAncestor): IJSONAncestor;
+ procedure CreateExcept(const S: String; Args: array of TVarRec); overload;
+ procedure CreateExcept(const S: String); overload; inline;
+ public
+ constructor Create(const Expression: String; JSON: IJSONAncestor; BlockException: Boolean = False);
+ destructor Destroy; override;
+ function ReadExpression: IJSONAncestor;
+ end;
+
+
+ // ## Parse
+ // --------
+
+ TLexemType = ( ltNil,
+ ltSValue, ltIValue, ltDValue, ltNull, ltCLeft, ltCRight,
+ ltBLeft, ltBRight, ltBSlash, ltColon, ltDot, ltVirgule,
+ ltName,
+ ltTrue,
+ ltFalse );
+
+ TLexemTypes = set of TLexemType;
+
+ TLexBuff = class
+ public
+ Capacity: Integer;
+ Length : Integer;
+ Buff: PWideChar;
+ constructor Create;
+ destructor Destroy; override;
+ function AsString: String; inline;
+ function AsInt64: Int64;
+ function AsDouble: Double;
+ function AsType: TLexemType;
+ function AsHInt: Int64;
+ procedure Add(Ch: WideChar); inline;
+ procedure Grow;
+ procedure Clear; inline;
+ end;
+
+ ILexeme = ^TLexeme;
+ TLexeme = record
+ Pos: TPosition;
+ Int: Int64;
+ Str: String;
+ Dbl: Double;
+ LType: TLexemType;
+ end;
+
+ TParseProc = (ppNil, ppInteger, ppDouble, ppString, ppName, ppEscape, ppEscapeUChar);
+
+ TTriggerProcs = set of (ttBuffer, ttEnd, ttBack);
+
+ TTrigger = class
+ public
+ TriggerProcs: TTriggerProcs;
+ ParseProcs: TParseProc;
+ NextRoute: TRoute;
+ BF: Boolean;
+ ED: Boolean;
+ BK: Boolean;
+ constructor Create(NextRoute: TRoute; TriggerProcs: TTriggerProcs; ParseProcs: TParseProc);
+ end;
+
+ TErrorTrigger = class(TTrigger)
+ private
+ FMessage: String;
+ function GetMeessage: String;
+ procedure SetMessage(const Value: String);
+ public
+ constructor Create(const Message: String);
+ property Message: String read GetMeessage write SetMessage;
+ end;
+
+
+ TNoRouteTrigger = class(TTrigger)
+ end;
+
+ TUseRouteTrigger = class(TTrigger)
+ end;
+
+ TJumpTrigger = class(TTrigger)
+ end;
+
+ {$WARNINGS OFF}
+ TRouteChars = set of Char;
+ {$WARNINGS ON}
+
+ TRoute = class
+ private
+ FName: String;
+ FTriggers: array[#0..MaxCHR] of TTrigger;
+ FTriggerList: TObjectList;
+ function GetIndex(Ch: WideChar): TTrigger; inline;
+ function GetName: String;
+ public
+ constructor Create(const Name: String);
+ destructor Destroy; override;
+ property Name: String read GetName;
+ procedure Add(const Chars: TRouteChars; Trigger: TTrigger);
+ procedure NoRoute(Trigger: TTrigger);
+ function TryGetRoute(Ch: WideChar; var Trg: TTrigger): Boolean; inline;
+ property Index[Ch: WideChar]: TTrigger read GetIndex; default;
+ end;
+
+ TLexGrammar = class
+ private
+ FRoutes: TList;
+ protected
+ function FirstRoute: TRoute; virtual; abstract;
+ function CreateRoute(const Name: String): TRoute;
+ function EscapeSupport: Boolean; virtual;
+ function EscapeRoute: TRoute; virtual;
+ public
+ constructor Create; virtual;
+ destructor Destroy; override;
+ end;
+
+ TJSONGrammar = class(TLexGrammar)
+ private
+ rFirst,
+ rName,
+ rString,
+ rString2,
+ rInt,
+ rDouble,
+ rExp, rExpE,
+ rExpPM,
+
+ rEscape,
+ rEscapeRoute,
+ rEscapeUChar: TRoute;
+
+ protected
+ function FirstRoute: TRoute; override;
+ function EscapeSupport: Boolean; override;
+ function EscapeRoute: TRoute; override;
+ public
+ constructor Create; override;
+ destructor Destroy; override;
+ end;
+
+ TLexGenerator = class
+ private
+ FFirstRoute: TRoute;
+ FBuffer: TLexBuff;
+ FEscapeBuff: TLexBuff;
+ FCurr: PWideChar;
+ FCurrPos: PPosition;
+ FLexem: ILexeme;
+ FLexG: TLexGrammar;
+ FEscapeSupport: Boolean;
+ FEscapeRoute: TRoute;
+ FExceptBlock: Boolean;
+ procedure CreateLexeme;
+ procedure NextLex;
+ procedure KillLex; inline;
+ public
+ constructor Create(LexG: TLexGrammar = nil; ExceptBlock: Boolean = False);
+ destructor Destroy; override;
+ procedure Load(const Source: String);
+ function Check(LTyp: TLexemType): Boolean; overload;
+ function Check(LTyp: TLexemTypes): TLexemType; overload;
+ function CheckName(var S: String): Boolean;
+ function CheckKill(LTyp: TLexemType): Boolean; overload;
+ function CheckKill(LTyp: TLexemTypes): TLexemType; overload;
+ function Current: ILexeme; inline;
+ property CurrPos: PPosition read FCurrPos;
+ end;
+
+ TSuperParser = class
+ public
+ class function ParseJSON(const S: String; const CheckDateTime: Boolean): IJSONAncestor;
+ end;
+
+ TISO8601 = record
+ private
+ FData: TMatch;
+ FSuccess: Boolean;
+ FOffset: Integer;
+ FUseTime: Boolean;
+ FUseDate: Boolean;
+ FValue: TDateTime;
+ FValueType: TDataType;
+ function NextOffset: Integer;
+ function GetIntData(const Index: Integer): Integer; overload; inline;
+ function GetIntData(const Index: Integer; const P: Boolean): Integer; overload;
+ function GetStrData(const Index: Integer): String; inline;
+ procedure ReadStructure;
+ procedure ReadZulu;
+ function ReadDate: Boolean;
+ function ReadTime: Boolean;
+ procedure ReadMS;
+ procedure ReadTZ(const P: Boolean);
+ public
+ constructor Create(const Value: String);
+ property Value: TDateTime read FValue;
+ property ValueType: TDataType read FValueType;
+ property Success: Boolean read FSuccess;
+ end;
+
+ function LimitedStrToUTF16(const Str: String): String;
+
+implementation
+
+uses
+ XSuperObject;
+
+const
+ FloatFormat : TFormatSettings = ( DecimalSeparator : '.' );
+ STokenTypes : array [TLexemType] of string = ('Nil',
+ 'String', 'Integer', 'Float', 'Null', '[', ']',
+ '(', ')', '\', ':', '.', ',',
+ '',
+ 'TRUE',
+ 'FALSE' );
+
+
+ optAll = [#0..#255];
+ optWhiteSpace = [' ', #0, #9, #10, #13];
+
+ optAlpha = ['a'..'z', 'A'..'Z', '$', '_', #127];
+ optSym = ['[', ']', '{', '}', ':', ',', '"', '''', '.'];
+ optNumeric = ['0'..'9'];
+ optEscape = ['b', 'f', 'n', 'r', 't', 'v', '''', '"', '\'];
+ optEscapeUnicode = ['u'];
+ optHex = ['A'..'F', 'a'..'f'] + optNumeric;
+ optStop = optWhiteSpace + optSym;
+
+ HexMap : array [0..15] of WideChar = ('0', '1', '2', '3', '4', '5', '6',
+ '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
+
+var
+ JSONLexGrammar: TJSONGrammar;
+ function iff(const Bool: Boolean; _true, _false: Variant): Variant; inline;
+ begin
+ if Bool then
+ Result := _true
+ else
+ Result := _false;
+ end;
+
+ function ChrToUTF16(const ChrCode: Integer): String; inline;
+ begin
+ Result := '\u' +
+ HexMap[ChrCode shr 12] +
+ HexMap[(ChrCode shr 8) and 15] +
+ HexMap[(ChrCode shr 4) and 15] +
+ HexMap[ChrCode and 15];
+ end;
+
+ function StrToUTF16(const Str: String): String;
+ var
+ Tmp: PWideChar;
+ begin
+ if Str = #0 then Exit(ChrToUtf16(0));
+ Result := '';
+ if Str = '' then
+ Exit
+ else
+ Tmp := PWideChar(Pointer(Str));
+ while Tmp^ <> #0 do
+ begin
+ case Tmp^ of
+ #1..#31: case Tmp^ of
+ #8 : Result := Result + '\b';
+ #9 : Result := Result + '\t';
+ #10: Result := Result + '\n';
+ //#11: Result := Result + '\v';
+ #12: Result := Result + '\f';
+ #13: Result := Result + '\r';
+ else
+ Result := Result + ChrtoUTF16(Ord(Tmp^))
+ end;
+ #34{"}: Result := Result + '\"';
+ #92{\}: Result := Result + '\\';
+ #127..#65535: Result := Result + ChrtoUTF16(Ord(Tmp^));
+ else
+ Result := Result + Tmp^;
+ end;
+ Inc(Tmp);
+ end;
+ end;
+
+ function LimitedStrToUTF16(const Str: String): String;
+ var
+ Tmp: PWideChar;
+ begin
+ if Str = #0 then Exit(ChrToUtf16(0));
+ Result := '';
+ if Str = '' then
+ Exit
+ else
+ Tmp := PWideChar(Pointer(Str));
+ while Tmp^ <> #0 do
+ begin
+ case Tmp^ of
+ #1..#31: case Tmp^ of
+ #8 : Result := Result + '\b';
+ #9 : Result := Result + '\t';
+ #10: Result := Result + '\n';
+ //#11: Result := Result + '\v';
+ #12: Result := Result + '\f';
+ #13: Result := Result + '\r';
+ else
+ Result := Result + ChrtoUTF16(Ord(Tmp^))
+ end;
+ else
+ Result := Result + Tmp^;
+ end;
+ Inc(Tmp);
+ end;
+ end;
+
+{ TJSONAncestor }
+
+procedure TJSONAncestor.AsJSONString(Str: TJSONWriter);
+begin
+ Str.Append('');
+end;
+
+function TJSONAncestor.GetDataType: TDataType;
+begin
+ with TCast.Create(Self) do
+ begin
+ Result := DataType;
+ Free;
+ end;
+end;
+
+function TJSONAncestor.GetIsNull: Boolean;
+begin
+ Result := Self is TJSONNull;
+end;
+
+function TJSONAncestor.GetAsVariant: Variant;
+begin
+ with TCast.Create(Self) do
+ begin
+ Result := AsVariant;
+ Free;
+ end;
+end;
+
+procedure TJSONAncestor.SetAsVariant(const Value: Variant);
+begin
+ with TCast.Create(Self) do
+ begin
+ AsVariant := Value;
+ Free;
+ end;
+end;
+
+{ TLexBuff }
+
+procedure TLexBuff.Add(Ch: WideChar);
+begin
+ if Capacity = 0 then Exit;
+ if (Length >= Capacity - Length) then Grow;
+ Buff[Length] := Ch;
+ Inc(Length);
+ Buff[Length] := #0;
+end;
+
+function TLexBuff.AsDouble: Double;
+var
+ Res: Extended;
+begin
+ Add(#0);
+ {$WARNINGS OFF}
+ if not TextToFloat(PWideChar(@Buff[0]), Res, fvExtended, FloatFormat) then
+ {$WARNINGS ON}
+ raise EConvertError.Create('')
+ else
+ Result := Res;
+end;
+
+function TLexBuff.AsHInt: Int64;
+var
+ I, J: Integer;
+begin
+ I := 0;
+ Result := 0;
+ while I < Length do
+ begin
+ J := Ord(Buff[I]);
+ Inc(I);
+ case J of
+ Ord('a')..Ord('f') :
+ J := J - (Ord('a') - 10);
+ Ord('A')..Ord('F') :
+ J := J - (Ord('A') - 10);
+ Ord('0')..Ord('9') :
+ J := J - Ord('0');
+ else
+ Continue;
+ end;
+ Result := (Result shl 4) or J;
+ end;
+end;
+
+function TLexBuff.AsInt64: Int64;
+begin
+ Result := StrToInt64(AsString);
+end;
+
+function TLexBuff.AsString: String;
+begin
+ SetString(Result, Buff, Length);
+end;
+
+function TLexBuff.AsType: TLexemType;
+begin
+ Result := ltName;
+ if Length = 0 then
+ Exit;
+
+ case Buff[0] of
+ '[': Result := ltCLeft;
+ ']': Result := ltCRight;
+ ':': Result := ltColon;
+ ',': Result := ltVirgule;
+ '{': Result := ltBLeft;
+ '}': Result := ltBRight;
+ '.': Result := ltDot;
+ else
+ if CompareText(STokenTypes[ltTrue], AsString) = 0 then
+ Result := ltTrue
+ else
+ if CompareText(STokenTypes[ltFalse], AsString) = 0 then
+ Result := ltFalse
+ else
+ if CompareText(STokenTypes[ltNull], AsString) = 0 then
+ Result := ltNull
+ end;
+end;
+
+procedure TLexBuff.Clear;
+begin
+ Length := 0;
+ Buff[0] := #0;
+end;
+
+constructor TLexBuff.Create;
+begin
+ inherited;
+ Length := 0;
+ Capacity := 32;
+ GetMem(Buff, Capacity * SizeOf(PWideChar));
+end;
+
+destructor TLexBuff.Destroy;
+begin
+ if Assigned(Buff) then
+ FreeMem(Buff);
+ inherited;
+end;
+
+procedure TLexBuff.Grow;
+begin
+ Capacity := Math.Max(Capacity * 2, Length + 8);
+ ReallocMem(Buff, Capacity * SizeOf(WideChar));
+end;
+
+{ TSuperParser }
+
+class function TSuperParser.ParseJSON(const S: String; const CheckDateTime: Boolean): IJSONAncestor;
+var
+ JSON: TJSONBuilder;
+begin
+ JSON := TJSONBuilder.Create(S, CheckDateTime);
+ try
+ Result := JSON.ReadValue;
+ finally
+ if Assigned(JSON) then
+ JSON.Free;
+ end;
+end;
+
+{ TTrigger }
+
+{ TTrigger }
+
+constructor TTrigger.Create(NextRoute: TRoute; TriggerProcs: TTriggerProcs;
+ ParseProcs: TParseProc);
+begin
+ Self.NextRoute := NextRoute;
+ Self.ParseProcs := ParseProcs;
+ Self.TriggerProcs := TriggerProcs;
+ BF := ttBuffer in TriggerProcs;
+ ED := ttEnd in TriggerProcs;
+ BK := ttBack in TriggerProcs;
+end;
+
+{ TRoute }
+
+procedure TRoute.Add(const Chars: TRouteChars; Trigger: TTrigger);
+var
+ Ch: WideChar;
+begin
+ Ch := #0;
+
+ if not FTriggerList.Contains(Trigger) then
+ FTriggerList.Add(Trigger);
+
+ while Ch <= MaxCHR do
+ begin
+ {$WARNINGS OFF}
+ if Ch in Chars then {$WARNINGS ON}
+ if not Assigned(FTriggers[Ch]) then
+ FTriggers[Ch] := Trigger;
+ Inc(Ch);
+ end;
+end;
+
+constructor TRoute.Create(const Name: String);
+begin
+ FName := Name;
+ FTriggerList := TObjectList.Create;
+end;
+
+
+destructor TRoute.Destroy;
+begin
+ FTriggerList.Free;
+ inherited;
+end;
+
+function TRoute.GetIndex(Ch: WideChar): TTrigger;
+begin
+ if Ch > MaxCHR then Ch := MaxCHR;
+ Result := FTriggers[Ch];
+end;
+
+function TRoute.GetName: String;
+begin
+ Result := FName;
+end;
+
+procedure TRoute.NoRoute(Trigger: TTrigger);
+var
+ Ch: WideChar;
+begin
+ Ch := #0;
+
+ if not FTriggerList.Contains(Trigger) then
+ FTriggerList.Add(Trigger);
+
+ while Ch <= MaxCHR do
+ begin
+ if not Assigned(FTriggers[Ch]) then
+ FTriggers[Ch] := Trigger;
+ Inc(Ch);
+ end;
+end;
+
+function TRoute.TryGetRoute(Ch: WideChar; var Trg: TTrigger): Boolean;
+begin
+ if Ch > MaxCHR then Ch := MaxCHR;
+ if FTriggers[Ch] <> nil then
+ begin
+ Result := True;
+ Trg := FTriggers[Ch];
+ end
+ else
+ Result := False;
+end;
+
+{ TLexGrammar }
+
+constructor TLexGrammar.Create;
+begin
+ FRoutes := TList.Create;
+end;
+
+destructor TLexGrammar.Destroy;
+begin
+ FRoutes.Free;
+ inherited;
+end;
+
+function TLexGrammar.EscapeRoute: TRoute;
+begin
+ Result := Nil;
+end;
+
+function TLexGrammar.EscapeSupport: Boolean;
+begin
+ Result := False;
+end;
+
+function TLexGrammar.CreateRoute(const Name: String): TRoute;
+begin
+ Result := TRoute.Create(Name);
+ FRoutes.Add(Result);
+end;
+
+{ TJSONGrammar }
+
+constructor TJSONGrammar.Create;
+begin
+ inherited;
+
+ rFirst := CreateRoute('First');
+ rName := CreateRoute('Name');
+ rString := CreateRoute('String');
+ rString2 := CreateRoute('String2');
+ rInt := CreateRoute('Int');
+ rDouble := CreateRoute('Double');
+
+ rExp := CreateRoute('Exp');
+ rExpE := CreateRoute('ExpE');
+ rExpPM := CreateRoute('ExpPM');
+
+ rEscape := CreateRoute('Escape');
+ rEscapeRoute := CreateRoute('EscapeRoute');
+ rEscapeUChar := CreateRoute('EscapeUChar');
+
+
+ rEscape.Add( ['\'], TJumpTrigger.Create(rEscapeRoute, [], ppNil ));
+
+ rEscapeRoute.Add(['u'], TJumpTrigger.Create(rEscapeUChar, [ttBuffer], ppNil));
+ rEscapeRoute.NoRoute(TUseRouteTrigger.Create(rEscape, [ttBuffer, ttEnd], ppEscape));
+
+ rEscapeUChar.Add(optHex, TUseRouteTrigger.Create(rEscapeUChar, [], ppEscapeUChar));
+ rEscapeUChar.NoRoute(TErrorTrigger.Create(ERR_UnexpectedTokenILLEGAL));
+
+ rFirst.Add(optSym - ['"', ''''], TUseRouteTrigger.Create(rFirst, [ttBuffer, ttEnd], ppName));
+ rFirst.Add(optAlpha, TUseRouteTrigger.Create(rName, [ttBuffer], ppNil));
+ rFirst.Add(['"'], TJumpTrigger.Create(rString, [ttBuffer], ppNil));
+ rFirst.Add([''''], TJumpTrigger.Create(rString2, [ttBuffer], ppNil));
+ rFirst.Add(optNumeric, TUseRouteTrigger.Create(rInt, [ttBuffer], ppNil));
+ rFirst.Add(optWhiteSpace - [#0], TJumpTrigger.Create(rFirst, [], ppNil));
+ rFirst.Add(['-'], TUseRouteTrigger.Create(rInt, [ttBuffer], ppNil));
+ rFirst.NoRoute(TErrorTrigger.Create(ERR_UnexpectedTokenILLEGAL));
+
+ rName.Add(optAll - optWhiteSpace - optSym, TUseRouteTrigger.Create(rName, [], ppNil));
+ rName.Add(optWhiteSpace, TJumpTrigger.Create(rFirst, [ttEnd, ttBack], ppName));
+ rName.NoRoute(TJumpTrigger.Create(rFirst, [ttEnd, ttBack], ppName));
+
+ rString.Add(optAll - ['"', #0, #10, #13], TUseRouteTrigger.Create(rString, [], ppNil));
+ rString.Add(['"'], TJumpTrigger.Create(rFirst, [ttEnd], ppString));
+ rString.Add([#0, #10, #13], TErrorTrigger.Create(ERR_UnexpectedTokenILLEGAL));
+
+ rString2.Add(optAll - ['''', #0, #10, #13], TUseRouteTrigger.Create(rString2, [], ppNil));
+ rString2.Add([''''], TJumpTrigger.Create(rFirst, [ttEnd], ppString));
+ rString2.Add([#0, #10, #13], TErrorTrigger.Create(ERR_UnexpectedTokenILLEGAL));
+
+ rInt.Add(optNumeric, TUseRouteTrigger.Create(rInt, [], ppNil));
+ rInt.Add(['.'], TUseRouteTrigger.Create(rDouble, [], ppNil));
+ rInt.Add(['e', 'E'], TUseRouteTrigger.Create(rExp, [], ppNil));
+ rInt.Add(optStop, TJumpTrigger.Create(rFirst, [ttEnd, ttBack], ppInteger));
+ rInt.NoRoute(TErrorTrigger.Create(ERR_UnexpectedTokenILLEGAL));
+
+ rDouble.Add(optNumeric, TUseRouteTrigger.Create(rDouble, [], ppNil));
+ rDouble.Add(['e', 'E'], TUseRouteTrigger.Create(rExp, [], ppNil));
+ rDouble.Add(optStop, TJumpTrigger.Create(rFirst, [ttEnd, ttBack], ppDouble));
+ rDouble.NoRoute(TErrorTrigger.Create(ERR_UnexpectedTokenILLEGAL));
+
+ rExp.Add(['+', '-'], TUseRouteTrigger.Create(rExpPM, [], ppNil));
+ rExp.Add(optNumeric, TUseRouteTrigger.Create(rExpE, [], ppNil));
+ rExp.NoRoute(TErrorTrigger.Create(Err_UnexpectedTokenILLEGAL));
+
+ rExpPM.Add(optNumeric, TUseRouteTrigger.Create(rExpE, [], ppNil));
+ rExpPM.NoRoute(TErrorTrigger.Create(Err_UnexpectedTokenILLEGAL));
+
+ rExpE.Add(optNumeric, TUseRouteTrigger.Create(rExpE, [], ppNil));
+ rExpE.Add(optStop, TJumpTrigger.Create(rFirst, [ttEnd, ttBack], ppDouble));
+ rExpE.NoRoute(TErrorTrigger.Create(Err_UnexpectedTokenILLEGAL));
+
+end;
+
+destructor TJSONGrammar.Destroy;
+begin
+ rFirst.Free;
+ rName.Free;
+ rString.Free;
+ rString2.Free;
+ rInt.Free;
+ rDouble.Free;
+ rExp.Free;
+ rExpE.Free;
+ rExpPM.Free;
+ rEscape.Free;
+ rEscapeRoute.Free;
+ rEscapeUChar.Free;
+ inherited;
+end;
+
+function TJSONGrammar.EscapeRoute: TRoute;
+begin
+ Result := rEscape;
+end;
+
+function TJSONGrammar.EscapeSupport: Boolean;
+begin
+ Result := True;
+end;
+
+function TJSONGrammar.FirstRoute: TRoute;
+begin
+ Result := rFirst;
+end;
+
+{ TErrorTrigger }
+
+constructor TErrorTrigger.Create(const Message: String);
+begin
+ inherited Create(Nil, [], ppNil);
+ FMessage := Message;
+end;
+
+function TErrorTrigger.GetMeessage: String;
+begin
+ Result := FMessage;
+end;
+
+procedure TErrorTrigger.SetMessage(const Value: String);
+begin
+ FMessage := Value;
+end;
+
+{ TLexGenerator }
+
+function TLexGenerator.Check(LTyp: TLexemTypes): TLexemType;
+begin
+ if not Assigned(FLexem) then
+ begin
+ NextLex;
+ if not Assigned(FLexem) then
+ Exit(ltNil);
+ end;
+ Result := iff(FLexem.LType in LTyp, FLexem.LType, ltNil);
+end;
+
+function TLexGenerator.Check(LTyp: TLexemType): Boolean;
+begin
+ if not Assigned(FLexem) then
+ begin
+ NextLex;
+ if not Assigned(FLexem) then
+ Exit(False);
+ end;
+ Result := FLexem.LType = LTyp;
+end;
+
+function TLexGenerator.CheckKill(LTyp: TLexemType): Boolean;
+begin
+ if not Assigned(FLexem) then
+ begin
+ NextLex;
+ if not Assigned(FLexem) then
+ Exit(False);
+ end;
+ if FLexem.LType = LTyp then
+ begin
+ KillLex;
+ Result := True;
+ end
+ else
+ Result := False;
+end;
+
+function TLexGenerator.CheckKill(LTyp: TLexemTypes): TLexemType;
+begin
+ if not Assigned(FLexem) then
+ begin
+ NextLex;
+ if not Assigned(FLexem) then
+ Exit(ltNil);
+ end;
+ if FLexem.LType in LTyp then
+ begin
+ Result := FLexem.LType;
+ KillLex;
+ end
+ else
+ Result := ltNil;
+end;
+
+function TLexGenerator.CheckName(var S: String): Boolean;
+var
+ lt: TLexemType;
+begin
+ lt := Check([ltSValue, ltName, ltDValue, ltIValue, ltTrue, ltFalse]);
+ if lt in [ltSValue, ltName, ltTrue, ltFalse] then
+ begin
+ if (Pos(#$D, FLexem.Str) > 0) or (Pos(#$A, FLexem.Str)>0) then
+ Exit(False);
+ Result := True;
+ S := FLexem.Str;
+ end
+ else
+ Result := False;
+end;
+
+constructor TLexGenerator.Create(LexG: TLexGrammar; ExceptBlock: Boolean);
+begin
+ FExceptBlock := ExceptBlock;
+ if not Assigned(LexG) then
+ FLexG := JSONLexGrammar
+ else
+ FLexG := LexG;
+ FFirstRoute := LexG.FirstRoute;
+ FBuffer := TLexBuff.Create;
+ FEscapeSupport := LexG.EscapeSupport;
+ if FEscapeSupport then
+ begin
+ FEscapeRoute := LexG.EscapeRoute;
+ FEscapeBuff := TLexBuff.Create;
+ end;
+ New(FCurrPos);
+ FCurrPos.Line := 1;
+ FCurrPos.Col := 0;
+end;
+
+procedure TLexGenerator.CreateLexeme;
+begin
+ KillLex;
+ New(FLexem);
+ FillChar(FLexem.Pos, SizeOf(TPosition), 0);
+ FLexem.LType := ltNull;
+end;
+
+function TLexGenerator.Current: ILexeme;
+begin
+ Result := FLexem;
+end;
+
+destructor TLexGenerator.Destroy;
+begin
+ KillLex;
+ FBuffer.Free;
+ if FEscapeSupport then
+ FEscapeBuff.Free;
+ Dispose(FCurrPos);
+ inherited;
+end;
+
+procedure TLexGenerator.KillLex;
+begin
+ if Assigned(FLexem) then
+ begin
+ Dispose(FLexem);
+ FLexem := Nil;
+ end;
+end;
+
+procedure TLexGenerator.Load(const Source: String);
+begin
+ FCurr := PWideChar(Source);
+end;
+
+{$HINTS OFF}
+procedure TLexGenerator.NextLex;
+var
+ Route: TRoute;
+ Trigger: TTrigger;
+ CTyp: TClass;
+ UseEscape, UseEscapeEnd: Boolean;
+begin
+ CreateLexeme;
+ UseEscape := False;
+ UseEscapeEnd := False;
+ FBuffer.Clear;
+ if FEscapeSupport then
+ begin
+ FEscapeRoute := FLexG.EscapeRoute;
+ FEscapeBuff.Clear;
+ end;
+
+ Route := FFirstRoute;
+ while Assigned(Route) do
+ begin
+
+ if FEscapeSupport then
+ begin
+ Trigger := FEscapeRoute[FCurr^];
+ if Trigger = Nil then
+ begin
+ Trigger := Route[FCurr^];
+ UseEscape := False;
+ end
+ else
+ UseEscape := True;
+ end
+ else
+ begin
+ Trigger := Route[FCurr^];
+ UseEscape := False;
+ end;
+
+ if Trigger = Nil then Exit;
+
+ CTyp := Trigger.ClassType;
+
+ if CTyp = TErrorTrigger then
+ if FCurr^ = #0 then
+ Break
+ else
+ if FExceptBlock then
+ Abort
+ else
+ raise TJSONSyntaxError.Create( TErrorTrigger(Trigger).Message, FCurrPos);
+
+ if CTyp = TUseRouteTrigger then
+ if UseEscape then
+ FEscapeBuff.Add(FCurr^)
+ else
+ FBuffer.Add(FCurr^);
+
+ if Trigger.BF and (FLexem.Pos.Col = 0) then
+ FLexem.Pos := FCurrPos^;
+
+ if not Trigger.BK then
+ begin
+ Inc(FCurr);
+ if FCurr^ = #10 then
+ begin
+ Inc(FCurrPos.Line);
+ FCurrPos.Col := 1;
+ end
+ else
+ Inc(FCurrPos.Col);
+ end;
+
+ if Trigger.ParseProcs <> ppNil then
+ begin
+ case Trigger.ParseProcs of
+ ppInteger: begin
+ FLexem.Int := FBuffer.AsInt64;
+ FLexem.LType := ltIValue;
+ end;
+ ppDouble:begin
+ FLexem.Dbl := FBuffer.AsDouble;
+ FLexem.LType := ltDValue;
+ end;
+ ppString:begin
+ FLexem.LType := ltSValue;
+ end;
+
+ ppName: begin
+ FLexem.Str := FBuffer.AsString;
+ FLexem.LType := FBuffer.AsType;
+ end;
+
+ ppEscapeUChar: begin
+ if FEscapeBuff.Length = 4 then
+ begin
+ FBuffer.Add(Chr(FEscapeBuff.AsHInt));
+ FEscapeBuff.Clear;
+ UseEscapeEnd := True;
+ end;
+ end;
+
+ ppEscape: begin
+ case FEscapeBuff.Buff[0] of
+ 'b' : FBuffer.Add(#8);
+ 't' : FBuffer.Add(#9);
+ 'n' : FBuffer.Add(#10);
+ 'v' : FBuffer.Add(#11);
+ 'f' : FBuffer.Add(#12);
+ 'r' : FBuffer.Add(#13);
+ '\' : FBuffer.Add('\');
+ '"' : FBuffer.Add('"');
+ '''': FBuffer.Add('''');
+ else
+ FBuffer.Add(FEscapeBuff.Buff[0]);
+ end;
+ FEscapeBuff.Clear;
+ end;
+ end;
+ end;
+
+ if Trigger.ED or UseEscapeEnd then
+ begin
+ if not UseEscape then
+ begin
+ FFirstRoute := Trigger.NextRoute;
+ FLexem.Str := FBuffer.AsString;
+ Exit;
+ end;
+ UseEscape := False;
+ UseEscapeEnd := False;
+ FEscapeRoute := FLexG.EscapeRoute;
+ end
+ else
+ if UseEscape then
+ FEscapeRoute := Trigger.NextRoute
+ else
+ Route := Trigger.NextRoute;
+ end;
+ KillLex;
+end;
+{$HINTS ON}
+
+{ TJSONBuilder }
+
+constructor TJSONBuilder.Create(const JSON: String; const CheckDates: Boolean);
+begin
+ LGen := TLexGenerator.Create(JSONLexGrammar);
+ LGen.Load(JSON);
+ FCheckDates := CheckDates;
+end;
+
+destructor TJSONBuilder.Destroy;
+begin
+ LGen.Free;
+ inherited;
+end;
+
+procedure TJSONBuilder.ReadArray(var Val: IJSONAncestor);
+var
+ Item: IJSONAncestor;
+begin
+ LGen.KillLex;
+ Val := TJSONArray.Create;
+
+ repeat
+ Item := ReadValue;
+ if Assigned(Item) then
+ TJSONArray(Val).Add(Item);
+ until not LGen.CheckKill(ltVirgule);
+
+ if not LGen.CheckKill(ltCRight) then
+ raise TJSONSyntaxError.Create(Err_UnexpectedEndOfInput, LGen.CurrPos);
+end;
+
+procedure TJSONBuilder.ReadFalse(var Val: IJSONAncestor);
+begin
+ Val := TJSONBoolean.Create(False);
+ LGen.KillLex;
+end;
+
+procedure TJSONBuilder.ReadFloat(var Val: IJSONAncestor);
+begin
+ Val := TJSONFloat.Create(LGen.Current.Dbl);
+ LGen.KillLex;
+end;
+
+procedure TJSONBuilder.ReadInteger(var Val: IJSONAncestor);
+begin
+ Val := TJSONInteger.Create(LGen.Current.Int);
+ LGen.KillLex;
+end;
+
+procedure TJSONBuilder.ReadNull(var Val: IJSONAncestor);
+begin
+ Val := TJSONNull.Create(True);
+ LGen.KillLex;
+end;
+
+procedure TJSONBuilder.ReadObject(var Val: IJSONAncestor);
+var
+ Name: String;
+begin
+ LGen.KillLex;
+ Val := TJSONObject.Create;
+ repeat
+ if LGen.CheckName(Name) then
+ begin
+ LGen.KillLex;
+ if not LGen.CheckKill(ltColon) then
+ raise TJSONSyntaxError.CreateFmt(Err_Expected, [':'], LGen.CurrPos);
+ TJSONObject(Val).AddPair(TJSONPair.Create(Name, ReadValue));
+ end
+ until not LGen.CheckKill(ltVirgule);
+
+ if not LGen.CheckKill(ltBRight) then
+ raise TJSONSyntaxError.Create(Err_UnexpectedEndOfInput, LGen.CurrPos);
+end;
+
+procedure TJSONBuilder.ReadString(var Val: IJSONAncestor);
+var
+ dT: TDateTime;
+ DVal: TDataType;
+label
+ JMP;
+begin
+ if (not FCheckDates) or (Length(LGen.Current.Str) > 25 {2015-10-20T12:22:24+00:00}) or (Length(LGen.Current.Str) < 5 {22:22}) then
+ JMP:Val := TJSONString.Create( LGen.Current.Str )
+ else
+ if TJSONDateManager.Check(LGen.Current.Str, dT, DVal ) then
+ case DVal of
+ dtDateTime: Val := TJSONDateTime.Create(dT);
+ dtDate : Val := TJSONDate.Create(TDate(dT));
+ dtTime : Val := TJSONTime.Create(TTime(dT));
+ else
+ goto JMP;
+ end
+ else
+ goto JMP;
+ LGen.KillLex;
+end;
+
+procedure TJSONBuilder.ReadTrue(var Val: IJSONAncestor);
+begin
+ Val := TJSONBoolean.Create(True);
+ LGen.KillLex;
+end;
+
+function TJSONBuilder.ReadValue: IJSONAncestor;
+begin
+ case LGen.Check([ ltSValue, ltIValue, ltDValue, ltBLeft, ltCLeft,
+ ltTrue, ltFalse, ltNull ]) of
+ ltSValue: ReadString(Result);
+ ltIValue: ReadInteger(Result);
+ ltDValue: ReadFloat(Result);
+ ltBLeft : ReadObject(Result);
+ ltTrue : ReadTrue(Result);
+ ltFalse : ReadFalse(Result);
+ ltCLeft : ReadArray(Result);
+ ltNull : ReadNull(Result);
+ else
+ Result := Nil;
+ end;
+end;
+
+{ TJSONString }
+
+procedure TJSONString.AsJSONString(Str: TJSONWriter);
+begin
+ if IsNull then
+ Str.AppendVal( cNull )
+ else
+ Str.AppendVal( '"' + StrToUTF16(Value) + '"' );
+end;
+
+{ TJSONInteger }
+
+procedure TJSONInteger.AsJSONString(Str: TJSONWriter);
+begin
+ if FNull then
+ Str.AppendVal( cNull )
+ else
+ Str.AppendVal( Value );
+end;
+
+
+{ TJSONFloat }
+
+procedure TJSONFloat.AsJSONString(Str: TJSONWriter);
+begin
+ if FNull then
+ Str.AppendVal( cNull )
+ else
+ Str.AppendVal( FloatToStr(Value, FloatFormat) );
+end;
+
+{ TJSONBoolean }
+
+procedure TJSONBoolean.AsJSONString(Str: TJSONWriter);
+begin
+ Str.AppendVal( String(iff( IsNull, cNull, iff( Value, 'true', 'false') )) );
+end;
+
+{ TJSONNull }
+
+procedure TJSONNull.AsJSONString(Str: TJSONWriter);
+begin
+ Str.AppendVal( cNull );
+end;
+
+function TJSONNull.GetIsNull: Boolean;
+begin
+ Result := True;
+end;
+
+{ TJSONObject }
+
+procedure TJSONObject.AddPair(P: IJSONPair);
+var
+ N: IJSONPair;
+begin
+ N := Get(P.Name);
+ if Assigned(N) then
+ begin
+ FPairList.Remove(N);
+ N := Nil;
+ end;
+ FPairList.Add(P);
+end;
+
+procedure TJSONObject.AddPair(Name: String; Value: IJSONAncestor);
+begin
+ AddPair( TJSONPair.Create(Name, Value) );
+end;
+
+procedure TJSONObject.AsJSONString(Str: TJSONWriter);
+var
+ P: IJSONPair;
+ I,L: Integer;
+begin
+ if FNull then
+ Str.AppendVal( cNull )
+ else
+ begin
+ Str.Append('{', True);
+ Str.Inc;
+ L := Count-1;
+ for I := 0 to L do
+ begin
+ P := FPairList[I];
+ Str.Append('"' + StrToUTF16(P.Name) + '":');
+ if Str.Ident and (P.JSONValue.DataType in [dtObject, dtArray]) then
+ Str.Append('', True);
+ P.JSONValue.AsJSONString(Str);
+ if I < L then
+ Str.AppendVal(',', Str.Ident);
+ end;
+ Str.Dec;
+ if Str.Ident then
+ Str.Append(#$D#$A);
+ Str.Append('}');
+ end;
+end;
+
+function TJSONObject.Count: Integer;
+begin
+ Result := FPairList.Count;
+end;
+
+constructor TJSONObject.Create;
+begin
+ FPairList := TList.Create;
+end;
+
+destructor TJSONObject.Destroy;
+begin
+ FPairList.Free;
+ inherited;
+end;
+
+function TJSONObject.Get(const Name: String): IJSONPair;
+var
+ P: IJSONPair;
+begin
+ for P in FPairList do
+ if CompareText(Name, P.Name) = 0 then
+ Exit(P);
+ Result := Nil;
+end;
+
+function TJSONObject.GetIsNull: Boolean;
+begin
+ Result := FNull;
+end;
+
+function TJSONObject.Get(const Index: Integer): IJSONPair;
+begin
+ if (FPairList.Count = 0) or (FPairList.Count <= Index) then
+ Result := Nil
+ else
+ Result := FPairList[Index];
+end;
+
+function TJSONObject.GetEnumerator: TJSONEnumerator;
+begin
+ Result.Index := -1;
+ Result.List := FPairList;
+end;
+
+class function TJSONObject.ParseJSONValue(const Str: String; const CheckDate: Boolean): IJSONAncestor;
+begin
+ Result := TSuperParser.ParseJSON(Str, CheckDate);
+end;
+
+procedure TJSONObject.Remove(P: IJSONPair);
+begin
+ Remove(P.Name);
+end;
+
+procedure TJSONObject.Remove(const Index: Integer);
+begin
+ if Count > Index then
+ FPairList.Delete(Index);
+end;
+
+procedure TJSONObject.Sort(Comparison: TJSONComparison);
+begin
+ FPairList.Sort( TComparer.Construct(
+ TComparison(Comparison)
+ ));
+end;
+
+procedure TJSONObject.Remove(const Name: String);
+var
+ R: IJSONPair;
+begin
+ R := Get(Name);
+ if Assigned(R) then
+ begin
+ FPairList.Remove(R);
+ R := Nil;
+ end;
+end;
+
+
+{ TJSONPair }
+
+constructor TJSONPair.Create(const aName: String; aValue: IJSONAncestor);
+begin
+ FName := aName;
+ FValue := aValue;
+end;
+
+destructor TJSONPair.Destroy;
+begin
+ FValue := Nil;
+ inherited;
+end;
+
+
+function TJSONPair.GetName: String;
+begin
+ Result := FName;
+end;
+
+function TJSONPair.GetValue: IJSONAncestor;
+begin
+ Result := FValue;
+end;
+
+procedure TJSONPair.SetName(const Value: String);
+begin
+ FName := Value;
+end;
+
+procedure TJSONPair.SetValue(const Value: IJSONAncestor);
+begin
+ FValue := Value;
+end;
+
+{ TJSONSyntaxError }
+
+constructor TJSONSyntaxError.Create(const Msg: String; Pos: PPosition);
+begin
+ inherited CreateFmt(Msg + '. (Line: %d Col: %d)', [Pos.Line, Pos.Col]);
+end;
+
+constructor TJSONSyntaxError.CreateFmt(const Msg: String; const Args: array of TVarRec;
+ Pos: PPosition);
+begin
+ Create( Format(Msg, Args), Pos );
+end;
+
+
+{ TJSONArray }
+
+procedure TJSONArray.Add(Val: IJSONAncestor);
+begin
+ FList.Add(Val);
+end;
+
+procedure TJSONArray.AsJSONString(Str: TJSONWriter);
+var
+ I,L: Integer;
+begin
+ if FNull then
+ Str.AppendVal( cNull )
+ else
+ begin
+ Str.Append('[', True);
+ Str.Inc;
+ L := Count - 1;
+ for I := 0 to L do
+ begin
+ if FList = Nil then Continue;
+ FList[I].AsJSONString(Str);
+ if I < L then
+ Str.AppendVal(',', Str.Ident);
+ end;
+ Str.Dec;
+ if Str.Ident then
+ Str.Append(#$D#$A);
+ Str.Append(']');
+ end;
+end;
+
+procedure TJSONArray.Clear;
+begin
+ FList.Clear;
+end;
+
+function TJSONArray.Count: Integer;
+begin
+ Result := FList.Count;
+end;
+
+constructor TJSONArray.Create;
+begin
+ FList := TList.Create;
+end;
+
+destructor TJSONArray.Destroy;
+begin
+ FList.Free;
+ inherited;
+end;
+
+function TJSONArray.Get(const I: Integer): IJSONAncestor;
+begin
+ if (FList.Count = 0) or (Flist.Count <= I) then
+ Result := Nil
+ else
+ Result := FList.Items[I]
+end;
+
+function TJSONArray.GetEnumerator: TJSONEnumerator;
+begin
+ Result.Index := -1;
+ Result.List := FList;
+end;
+
+function TJSONArray.GetIsNull: Boolean;
+begin
+ Result := FNull;
+end;
+
+procedure TJSONArray.Remove(Val: IJSONAncestor);
+begin
+ FList.Remove(Val);
+end;
+
+procedure TJSONArray.Remove(Index: Integer);
+begin
+ FList.Delete(Index);
+end;
+
+procedure TJSONArray.SetIndex(const Int: Integer; const Value: IJSONAncestor);
+begin
+ if (FList.Count = 0) or (Flist.Count <= Int) then
+ Exit;
+ FList[Int] := Value;
+end;
+
+procedure TJSONArray.Sort(Comparison: TJSONComparison);
+begin
+ FList.Sort( TComparer.Construct(
+ TComparison(Comparison)
+ ));
+end;
+
+{ TJSONValue }
+
+constructor TJSONValue.Create(const Value: T);
+begin
+ FData := Value;
+ FNull := False;
+end;
+
+constructor TJSONValue.CreateNull;
+begin
+ FNull := True;
+end;
+
+function TJSONValue.GetData: T;
+begin
+ Result := FData;
+end;
+
+function TJSONValue.GetIsNull: Boolean;
+begin
+ Result := FNull;
+end;
+
+procedure TJSONValue.SetData(const Value: T);
+begin
+ FData := Value;
+end;
+
+procedure TJSONValue.SetNull;
+begin
+ FNull := True;
+end;
+
+{ TJSONInterpreter }
+
+constructor TJSONInterpreter.Create(const Expression: String;
+ JSON: IJSONAncestor; BlockException: Boolean = False);
+begin
+ LGen := TLexGenerator.Create(JSONLexGrammar, BlockException);
+ LGen.Load(Expression);
+ FJSON := JSON;
+ FExceptionBlock := BlockException;
+end;
+
+procedure TJSONInterpreter.CreateExcept(const S: String;
+ Args: array of TVarRec);
+begin
+ if FExceptionBlock then
+ Abort
+ else
+ raise TJSONSyntaxError.CreateFmt(S, Args, LGen.CurrPos);
+end;
+
+procedure TJSONInterpreter.CreateExcept(const S: String);
+begin
+ if FExceptionBlock then
+ Abort
+ else
+ raise TJSONSyntaxError.Create(S, LGen.CurrPos);
+end;
+
+destructor TJSONInterpreter.Destroy;
+begin
+ LGen.Free;
+ inherited;
+end;
+
+function TJSONInterpreter.ReadArray(Base: IJSONAncestor): IJSONArray;
+var
+ Item: IJSONAncestor;
+begin
+ LGen.KillLex;
+ Result := TJSONArray.Create;
+ repeat
+ Item := ReadValue(Base);
+ if Assigned(Item) then
+ TJSONArray(Result).Add(Item);
+ until not LGen.CheckKill(ltVirgule);
+
+ if not LGen.CheckKill(ltCRight) then
+ CreateExcept(Err_UnexpectedEndOfInput);
+end;
+
+function TJSONInterpreter.ReadArrayIndex(Base: IJSONArray): IJSONAncestor;
+var
+ RName: IJSONAncestor;
+ Index: Integer;
+begin
+ Index := 0;
+ case LGen.Check([ltIValue, ltName]) of
+ ltIValue:
+ begin
+ Index := StrToInt(LGen.Current.Str);
+ LGen.KillLex;
+ end;
+ ltName:
+ begin
+ RName := ReadName(FJSON);
+ if not (RName is TJSONInteger) then
+ CreateExcept(Err_ExpectedButFound, [STokenTypes[ltIValue], STokenTypes[LGen.Current.LType]])
+ else
+ Index := TJSONInteger(RName).Value;
+ end
+ else
+ CreateExcept(Err_ExpectedButFound, [STokenTypes[ltIValue], STokenTypes[LGen.Current.LType]])
+ end;
+ Result := Base.Index[Index];
+ if not LGen.CheckKill(ltCRight) then
+ CreateExcept(Err_Expected, [STokenTypes[ltCRight]]);
+ if LGen.CheckKill(ltDot) then
+ begin
+ RName := ReadName(Result);
+ if Assigned(RName) then
+ Result := RName;
+ end;
+end;
+
+function TJSONInterpreter.ReadExpression: IJSONAncestor;
+begin
+ try
+ case LGen.Check([ltBLeft, ltCLeft]) of
+ ltBLeft : Result := ReadObject(FJSON);
+ ltCLeft : Result := ReadArray(FJSON);
+ else
+ Result := ReadName(FJSON);
+ end;
+ except
+ on E: Exception do
+ begin
+ if FExceptionBlock then
+ Result := Nil
+ else
+ raise;
+ end;
+ end;
+end;
+
+function TJSONInterpreter.ReadName(Base: IJSONAncestor): IJSONAncestor;
+var
+ Name: String;
+ Pair: IJSONPair;
+begin
+ if not LGen.CheckName(Name) then
+ Exit(Nil);
+
+ if Base is TJSONArray then
+ begin
+ if LGen.Current.LType <> ltIValue then
+ CreateExcept(Err_ExpectedButFound, [STokenTypes[ltIValue], STokenTypes[LGen.Current.LType]])
+ else
+ Result := TJSONArray(Base).Index[StrToInt(Name)];
+ end
+ else
+ if Base is TJSONObject then
+ begin
+ Pair := TJSONObject(Base).Get(Name);
+ if Pair = Nil then
+ Exit(Nil)
+ else
+ Result := Pair.JSONValue;
+ LGen.KillLex;
+ if Assigned(Result) then
+ case LGen.CheckKill([ltDot, ltCLeft]) of
+ ltDot:
+ Result := ReadName(Result);
+ ltCLeft:
+ begin
+ if Result is TJSONArray then
+ Result := ReadArrayIndex(TJSONArray(Result))
+ else
+ CreateExcept(Err_Expected, ['Array']);
+ end;
+ end;
+ end
+ else
+ Result := Nil;
+end;
+
+function TJSONInterpreter.ReadObject(Base: IJSONAncestor): IJSONObject;
+var
+ Name: String;
+begin
+ LGen.KillLex;
+ Result := TJSONObject.Create;
+ repeat
+ if LGen.CheckName(Name) then
+ begin
+ LGen.KillLex;
+ if not LGen.CheckKill(ltColon) then
+ CreateExcept(Err_Expected, [':']);
+ TJSONObject(Result).AddPair(TJSONPair.Create(Name, ReadValue(Base)));
+ end
+ until not LGen.CheckKill(ltVirgule);
+
+ if not LGen.CheckKill(ltBRight) then
+ CreateExcept(Err_UnexpectedEndOfInput);
+end;
+
+function TJSONInterpreter.ReadValue(Base: IJSONAncestor): IJSONAncestor;
+begin
+ case LGen.Check([ ltSValue, ltIValue, ltDValue, ltBLeft, ltCLeft,
+ ltTrue, ltFalse, ltName, ltNull ]) of
+ ltSValue: Result := TJSONString.Create(LGen.Current.Str);
+ ltIValue: Result := TJSONInteger.Create(LGen.Current.Int);
+ ltDValue: Result := TJSONFloat.Create(LGen.Current.Dbl);
+ ltBLeft : Result := ReadObject(Base);
+ ltTrue : Result := TJSONBoolean.Create(True);
+ ltFalse : Result := TJSONBoolean.Create(False);
+ ltCLeft : Result := ReadArray(Base);
+ ltNull : Result := TJSONNull.Create(True);
+ ltName : begin
+ Result := ReadName(Base);
+ Exit;
+ end
+ else
+ Result := Nil;
+ Exit;
+ end;
+ LGen.KillLex;
+end;
+
+{ TSuperEnumerator }
+
+function TJSONEnumerator.GetCurrent: T;
+begin
+ Result := List[Index]
+end;
+
+function TJSONEnumerator.MoveNext: Boolean;
+begin
+ Result := Index < List.Count - 1;
+ if Result then
+ Inc(Index);
+end;
+
+{ TJSONWriter }
+
+function TJSONWriter.Append(const Value: string; const CRLF: Boolean = False): TJSONWriter;
+begin
+ if FIdent then
+ begin
+ FData.Append(' ', FIdentOffset);
+ if CRLF then
+ FData.AppendLine(Value)
+ else
+ FData.Append(Value)
+ end
+ else
+ FData.Append(Value);
+ Result := Self;
+end;
+
+function TJSONWriter.Append(const Value: int64; const CRLF: Boolean): TJSONWriter;
+begin
+ Result := Append(IntToStr(Value), CRLF);
+end;
+
+function TJSONWriter.AppendVal(const Value: string; const CRLF: Boolean): TJSONWriter;
+begin
+ if CRLF then
+ FData.AppendLine(Value)
+ else
+ FData.Append(Value);
+ Result := Self;
+end;
+
+function TJSONWriter.AppendVal(const Value: int64; const CRLF: Boolean): TJSONWriter;
+begin
+ Result := Append(IntToStr(Value), CRLF);
+end;
+
+constructor TJSONWriter.Create(const useIdent, useUniversalTime: Boolean);
+begin
+ inherited Create;
+ FData := TStringBuilder.Create;
+ FIdent := useIdent;
+ FUniversalTime := useUniversalTime;
+ FIdentOffset := 0;
+end;
+
+procedure TJSONWriter.Dec;
+begin
+ System.Dec(FIdentOffset, IDENT_SIZE);
+end;
+
+destructor TJSONWriter.Destroy;
+begin
+ FData.Free;
+ inherited;
+end;
+
+procedure TJSONWriter.Inc;
+begin
+ System.Inc(FIdentOffset, IDENT_SIZE);
+end;
+
+function TJSONWriter.ToString: string;
+begin
+ Result := FData.ToString;
+end;
+
+{ TJSONDateTime }
+
+constructor TJSONDateTime.Create(const Value: TDateTime; const Format: String);
+begin
+ inherited Create(Value);
+ FFormat := Format;
+end;
+
+{ TJSONDateManager }
+
+class function TJSONDateManager.Check(const Data: String; var AValue: TDateTime;
+ var Typ: TDataType): Boolean;
+var
+ CallBck: TJSONDateTimeCheckCallBack;
+begin
+ for CallBck in FFormats do
+ if CallBck(Data, AValue, Typ) then
+ Exit(True);
+ Result := False;
+end;
+
+class constructor TJSONDateManager.Create;
+begin
+ FFormats := TList.Create;
+end;
+
+class destructor TJSONDateManager.Destroy;
+{$IF CompilerVersion < 29}
+var
+ I: Integer;
+{$ENDIF}
+begin
+ if Assigned(FFormats) then begin
+ {$IF CompilerVersion < 29}
+ for I := 0 to FFormats.Count - 1 do
+ FFormats.List[I]._Release;
+ {$ENDIF}
+ FFormats.Free;
+ end;
+end;
+
+class function TJSONDateManager.GetFormats: TList;
+begin
+ Result := FFormats;
+end;
+
+{ TISO8601 }
+
+constructor TISO8601.Create(const Value: String);
+var
+ Matches: TMatchCollection;
+begin
+ FillChar(Self, SizeOf(TISO8601), #0);
+ Matches := TRegEx.Matches(Value, '(?=\d{4})((\d{4})-(\d{2})-(\d{2}))?(T(\d{2})\:(\d{2})\:('+
+ '\d{2})(Z)?(\.(\d{1,3})(Z)?)?([+-](\d{2})\:(\d{2}))?)?|(\d{2})\:('+
+ '\d{2})\:(\d{2})(Z)?(\.(\d{1,3}))?([+-](\d{2})\:(\d{2}))?');
+ if Matches.Count <> 1 then Exit;
+ FData := Matches.Item[0];
+ FSuccess := Trim(FData.Value) = Trim(Value);
+ if not FSuccess then Exit;
+ ReadStructure;
+end;
+
+function TISO8601.GetIntData(const Index: Integer): Integer;
+begin
+ Result := StrToInt(GetStrData(Index));
+end;
+
+function TISO8601.GetIntData(const Index: Integer; const P: Boolean): Integer;
+begin
+ Result := GetIntData(Index);
+ if not P then
+ Result := -1 * Result;
+end;
+
+function TISO8601.GetStrData(const Index: Integer): String;
+begin
+ Result := FData.Groups.Item[Index].Value;
+end;
+
+function TISO8601.NextOffset: Integer;
+begin
+ Inc(FOffset);
+ Result := FOffset;
+end;
+
+procedure TISO8601.ReadStructure;
+var
+ Len, VLen: Integer;
+ Grp: TGroup;
+begin
+ FOffset := 1;
+ Len := FData.Groups.Count - 1;
+ while FOffset <= Len do
+ begin
+ Grp := FData.Groups.Item[FOffset];
+ with Grp do
+ if Value > '' then begin
+ VLen := System.Length(Value);
+ if (Value[CharIndex] <> '.') and (VLen = 4) then begin
+ Dec(FOffset);
+ ReadDate
+ end else
+ case Value[CharIndex] of
+ '0'..'9': if VLen = 2 then begin
+ FUseTime := True;
+ Dec(FOffset);
+ if not ReadTime then
+ begin
+ FSuccess := False;
+ Exit;
+ end;
+ end;
+
+ 'T', 't': begin
+ FUseTime := True;
+ if not ReadTime then
+ begin
+ FSuccess := False;
+ Exit;
+ end;
+ end;
+ 'Z': if FUseTime then ReadZulu;
+ '.': if FUseTime then ReadMS;
+ '+': if FUseTime then ReadTZ(True);
+ '-': if FUseTime then ReadTZ(False);
+ end;
+ end;
+ Inc(FOffset);
+ end;
+ if FUseDate and FUseTime then
+ FValueType := dtDateTime
+ else if FUseDate then
+ FValueType := dtDate
+ else if FUseTime then
+ FValueType := dtTime;
+end;
+
+function TISO8601.ReadDate: Boolean;
+begin
+ Result := True;
+ if not TryEncodeDate( GetIntData(NextOffset), GetIntData(NextOffset), GetIntData(NextOffset), FValue ) then
+ begin
+ FValue := 0;
+ Result := False;
+ end
+ else
+ FUseDate := True
+end;
+
+procedure TISO8601.ReadMS;
+var
+ Temp: TDateTime;
+begin
+ if TryEncodeTime(0, 0, 0, GetIntData(NextOffset), Temp) then
+ FValue := FValue + TTime(Temp);
+end;
+
+function TISO8601.ReadTime: Boolean;
+var
+ Temp: TDateTime;
+begin
+ if TryEncodeTime(GetIntData(NextOffset), GetIntData(NextOffset), GetIntData(NextOffset), 0, Temp ) then
+ begin
+ FValue := FValue + TTime(Temp);
+ FUseTime := True;
+ Result := True;
+ end
+ else
+ Result := False;
+end;
+
+procedure TISO8601.ReadTZ(const P: Boolean);
+begin
+ FValue := IncHour(FValue, -1 * GetIntData(NextOffset, P));
+ FValue := IncMinute(FValue, -1 * GetIntData(NextOffset, P));
+ FValue := TTimeZone.Local.ToLocalTime(FValue)
+end;
+
+
+procedure TISO8601.ReadZulu;
+begin
+ FValue := TTimeZone.Local.ToLocalTime(FValue);
+end;
+
+{ TJSONDate }
+
+constructor TJSONDate.Create(const Value: TDate; const Format: String);
+begin
+ inherited Create(Value);
+ FFormat := Format;
+end;
+
+{ TJSONTime }
+
+constructor TJSONTime.Create(const Value: TTime; const Format: String);
+begin
+ inherited Create(Value);
+ FFormat := Format;
+end;
+
+{ TJSONBaseDate }
+
+procedure TJSONBaseDate.AsJSONString(Str: TJSONWriter);
+begin
+ if FNull then
+ Str.AppendVal( cNull )
+ else
+ begin
+ if Str.UniversalTime then
+ Str.AppendVal( '"' + FormatDateTime(FFormat, TTimeZone.Local.ToUniversalTime(PDateTime(@FData)^)) + 'Z"' )
+ else
+ Str.AppendVal( '"' + FormatDateTime(FFormat, PDateTime(@FData)^) + '"' );
+ end;
+end;
+
+function TJSONBaseDate.GetAsString: String;
+begin
+ Result := FormatDateTime(FFormat, PDateTime(@FData)^);
+end;
+
+{ TJSONRaw }
+
+procedure TJSONRaw.AsJSONString(Str: TJSONWriter);
+begin
+ Str.AppendVal( Value );
+end;
+
+initialization
+
+ JSONLexGrammar := TJSONGrammar.Create;
+
+ TJSONDateManager.Formats.Add( (* ISO-8601 | [Date] + [ Time + [MS] + [UTC] + [Z] ] *)
+ function(Str: String; var AValue: TDateTime; var Typ: TDataType): Boolean
+ begin
+ with TISO8601.Create(Str) do
+ begin
+ Result := Success;
+ if Result then
+ begin
+ AValue := Value;
+ Typ := ValueType;
+ end;
+ end;
+ end);
+
+finalization
+
+ JSONLexGrammar.Free;
+
+end.
diff --git a/v1.4.4/Exemplo/XSuperObject.inc b/v1.4.4/Exemplo/XSuperObject.inc
new file mode 100644
index 0000000..9f43fbb
--- /dev/null
+++ b/v1.4.4/Exemplo/XSuperObject.inc
@@ -0,0 +1,41 @@
+ (*
+ * XSuperObject - Simple JSON Framework
+ *
+ * The MIT License (MIT)
+ * Copyright (c) 2015 Onur YILDIZ
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
+ * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *)
+
+ (*
+ * Marshalling Options
+ *)
+ {$DEFINE SP_DATASET}
+ {$DEFINE SP_STREAM}
+
+ // ** Zero Based Strings Definations...
+ {$UNDEF XE2UP}
+ {$IFDEF DCC}
+ {$IF CompilerVersion >= 24}
+ {$DEFINE XE2UP}
+ {$ENDIF}
+ {$ENDIF}
\ No newline at end of file
diff --git a/v1.4.4/Exemplo/XSuperObject.pas b/v1.4.4/Exemplo/XSuperObject.pas
new file mode 100644
index 0000000..2aeb3b8
--- /dev/null
+++ b/v1.4.4/Exemplo/XSuperObject.pas
@@ -0,0 +1,3456 @@
+ (*
+ * XSuperObject - Simple JSON Framework
+ *
+ * The MIT License (MIT)
+ * Copyright (c) 2015 Onur YILDIZ
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
+ * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *)
+
+unit XSuperObject;
+
+interface
+
+{$I XSuperObject.inc}
+
+uses
+ Classes,
+ Variants,
+ SysUtils,
+ Character,
+ XSuperJSON,
+ RTTI,
+ TypInfo,
+ Generics.Collections
+ {$IFDEF SP_DATASET}
+ ,DB
+ {$ENDIF}
+ {$IFDEF SP_STREAM}
+ ,IdGlobal
+ ,IdCoderMIME
+ {$ENDIF}
+ ;
+
+{$IFDEF XE2UP}
+ const CharIndex = Low(String);
+{$ELSE}
+ const CharIndex = 1;
+{$ENDIF}
+
+type
+
+ SOException = class(Exception) end;
+ SOInvalidDate = class(SOException) end;
+ ESerializeError = class(Exception) end;
+
+ ISuperObject = interface;
+ ISuperArray = interface;
+ ICast = Interface;
+ IMember = ICast;
+ TSuperObject = class;
+ TSuperArray = class;
+
+ TMemberStatus = (jUnAssigned, jNull, jAssigned);
+ TJSONType = (jtObject, jtArray);
+
+ Alias = class(TCustomAttribute)
+ private
+ FName: String;
+ public
+ constructor Create(const AName: String);
+ property Name: String read FName write FName;
+ end;
+
+ TRevalOption = (roNone, roEmptyArrayToNull);
+
+ REVAL = class(TCustomAttribute)
+ private
+ FOption: TRevalOption;
+ FEqual: Variant;
+ FValue: Variant;
+ public
+ constructor Create(EQVal: String; NewVal: String); overload;
+ constructor Create(EQVal: Integer; NewVal: Integer); overload;
+ constructor Create(EQVal: Boolean; NewVal: Boolean); overload;
+ constructor Create(EQVal: Double; NewVal: Double); overload;
+ constructor Create(EQVal: String); overload;
+ constructor Create(EQVal: Integer); overload;
+ constructor Create(EQVal: Double); overload;
+ constructor Create(EQVal: Boolean); overload;
+ constructor Create(Option: TRevalOption); overload;
+ function CheckEQ(Val: TValue): Boolean;
+ property Equal: Variant read FEqual;
+ property Value: Variant read FValue;
+ property Option: TRevalOption read FOption;
+ end;
+
+ DISABLE = class(TCustomAttribute)
+ end;
+
+ DISABLEREAD = class(TCustomAttribute)
+ end;
+
+ DISABLEWRITE = class(TCustomAttribute)
+ end;
+
+ IBase = interface
+ ['{872FA14E-9276-4F86-A8D8-832CF39DACE6}']
+ function AsObject: ISuperObject;
+ function AsArray: ISuperArray;
+ end;
+
+ TBase = class(TInterfacedObject, IBase)
+ function AsObject: ISuperObject; virtual;
+ function AsArray: ISuperArray; virtual;
+ end;
+
+ IBaseJSON = interface(IBase)
+ ['{EBD49266-BEF2-4B79-9BAF-329F725E0568}']
+ function GetBoolean(V: Typ): Boolean;
+ function GetInteger(V: Typ): Int64;
+ function GetString(V: Typ): String;
+ procedure SetBoolean(V: Typ; const Value: Boolean);
+ procedure SetInteger(V: Typ; const Value: Int64);
+ procedure SetString(V: Typ; const Value: String);
+ function GetObject(V: Typ): ISuperObject;
+ procedure SetObject(V: Typ; const Value: ISuperObject);
+ function GetArray(V: Typ): ISuperArray;
+ procedure SetArray(V: Typ; const Value: ISuperArray);
+ function GetDouble(V: Typ): Double;
+ procedure SetDouble(V: Typ; const Value: Double);
+ function GetVariant(V: Typ): Variant;
+ procedure SetVariant(V: Typ; const Value: Variant);
+ function GetDateTime(V: Typ): TDateTime;
+ procedure SetDateTime(V: Typ; const Value: TDateTime);
+ function GetDate(V: Typ): TDate;
+ procedure SetDate(V: Typ; const Value: TDate);
+ function GetTime(V: Typ): TTime;
+ procedure SetTime(V: Typ; const Value: TTime);
+ function GetSelf: T;
+ function GetAncestor(V: Typ): IJSONAncestor;
+ function GetNull(V: Typ): TMemberStatus;
+ procedure SetNull(V: Typ; const Value: TMemberStatus);
+ function GetDataType: TDataType;
+
+ property Null[V: Typ]: TMemberStatus read GetNull write SetNull;
+ property S[V: Typ]: String read GetString write SetString;
+ property I[V: Typ]: Int64 read GetInteger write SetInteger;
+ property B[V: Typ]: Boolean read GetBoolean write SetBoolean;
+ property F[V: Typ]: Double read GetDouble write SetDouble;
+ property O[V: Typ]: ISuperObject read GetObject write SetObject;
+ property A[V: Typ]: ISuperArray read GetArray write SetArray;
+ property V[V: Typ]: Variant read GetVariant write SetVariant;
+ property D[V: Typ]: TDateTime read GetDateTime write SetDateTime;
+ property Date[V: Typ]: TDate read GetDate write SetDate;
+ property Time[V: Typ]: TTime read GetTime write SetTime;
+ property Ancestor[V: Typ]: IJSONAncestor read GetAncestor;
+ function Contains(Key: Typ): Boolean;
+ function GetType(Key: Typ): TVarType;
+ procedure Sort(Comparison: TJSONComparison);
+ procedure SaveTo(Stream: TStream; const Ident: Boolean = false; const UniversalTime : Boolean = false); overload;
+ procedure SaveTo(AFile: String; const Ident: Boolean = false; const UniversalTime : Boolean = false); overload;
+ function AsJSON(const Ident: Boolean = False; const UniversalTime: Boolean = False): String;
+ property Self: T read GetSelf;
+ property DataType: TDataType read GetDataType;
+ end;
+
+ TJSONValueHelper = class helper for TJSONAncestor
+ public
+ function ValueEx: Variant;
+ end;
+
+ TCondCallBack = reference to function(Arg: T): Boolean;
+
+ TBaseJSON = class(TBase, IBaseJSON)
+ protected
+ FJSONObj: T;
+ FCasted: IJSONAncestor;
+ FInterface: IInterface;
+ FCheckDate: Boolean;
+ function ContainsEx(Key: Typ; out Value: IJSONAncestor): Boolean;
+ function DefaultValueClass(const Value): TT;
+ procedure Member(const Name: Typ; const Value: TValue); overload;
+ function Member(const Name: Typ): Boolean; overload;
+ function GetValue(const Name: Typ): C;
+ function GetSelf: T;
+ function GetData(Key: Typ): IJSONAncestor;
+ function GetVariant(V: Typ): Variant;
+ procedure SetVariant(V: Typ; const Value: Variant);
+ function GetDataType: TDataType;
+ protected
+ function GetObject(V: Typ): ISuperObject; virtual;
+ function GetArray(V: Typ): ISuperArray; virtual;
+ function GetBoolean(V: Typ): Boolean; virtual;
+ function GetInteger(V: Typ): Int64; virtual;
+ function GetString(V: Typ): String; virtual;
+ function GetDouble(V: Typ): Double; virtual;
+ function GetAncestor(V: Typ): IJSONAncestor; inline;
+ function GetNull(V: Typ): TMemberStatus; virtual;
+ function GetDateTime(V: Typ): TDateTime; virtual;
+ function GetDate(V: Typ): TDate; virtual;
+ function GetTime(V: Typ): TTime; virtual;
+ procedure SetDate(V: Typ; const Value: TDate); virtual;
+ procedure SetTime(V: Typ; const Value: TTime); virtual;
+ procedure SetDateTime(V: Typ; const Value: TDateTime); virtual;
+ procedure SetObject(V: Typ; const Value: ISuperObject); virtual;
+ procedure SetArray(V: Typ; const Value: ISuperArray); virtual;
+ procedure SetBoolean(V: Typ; const Value: Boolean); virtual;
+ procedure SetInteger(V: Typ; const Value: Int64); virtual;
+ procedure SetString(V: Typ; const Value: String); virtual;
+ procedure SetDouble(V: Typ; const Value: Double); virtual;
+ procedure SetNull(V: Typ; const Value: TMemberStatus); virtual;
+ public
+ constructor Create(JSON: String = '{}'; const CheckDate: Boolean = True); overload;
+ constructor Create(JSON: T; const CheckDate: Boolean = True); overload;
+ constructor CreateCasted(Value: IJSONAncestor; const CheckDate: Boolean = True);
+ constructor CreateWithEscape(JSON: String = '{}'; const CheckDate: Boolean = True);
+ destructor Destroy; override;
+ property Null[V: Typ]: TMemberStatus read GetNull write SetNull;
+ property S[V: Typ]: String read GetString write SetString;
+ property I[V: Typ]: Int64 read GetInteger write SetInteger;
+ property B[V: Typ]: Boolean read GetBoolean write SetBoolean;
+ property F[V: Typ]: Double read GetDouble write SetDouble;
+ property O[V: Typ]: ISuperObject read GetObject write SetObject;
+ property A[V: Typ]: ISuperArray read GetArray write SetArray;
+ property V[V: Typ]: Variant read GetVariant write SetVariant;
+ property D[V: Typ]: TDateTime read GetDateTime write SetDateTime;
+ property Date[V: Typ]: TDate read GetDate write SetDate;
+ property Time[V: Typ]: TTime read GetTime write SetTime;
+ property Ancestor[V: Typ]: IJSONAncestor read GetAncestor;
+ function Contains(Key: Typ): Boolean;
+ function GetType(Key: Typ): TVarType;
+ procedure Sort(Comparison: TJSONComparison); virtual; abstract;
+ procedure SaveTo(Stream: TStream; const Ident: Boolean = false; const UniversalTime : Boolean = false); overload; virtual; abstract;
+ procedure SaveTo(AFile: String; const Ident: Boolean = false; const UniversalTime : Boolean = false); overload; virtual; abstract;
+ function AsJSON(const Ident: Boolean = False; const UniversalTime: Boolean = False): String; inline;
+ property Self: T read GetSelf;
+ property DataType: TDataType read GetDataType;
+ end;
+
+
+ ICast = interface
+ ['{0F5387AB-C1C9-4229-921D-226960332271}']
+ function GetArray: ISuperArray;
+ function GetBoolean: Boolean;
+ function GetDataType: TDataType;
+ function GetFloat: Double;
+ function GetInteger: Int64;
+ function GetObject: ISuperObject;
+ function GetString: String;
+ function GetName: String;
+ function GetVariant: Variant;
+ function GetDate: TDate;
+ function GetDateTime: TDateTime;
+ function GetTime: TTime;
+ procedure SetDate(const Value: TDate);
+ procedure SetDateTime(const Value: TDateTime);
+ procedure SetTime(const Value: TTime);
+ procedure SetBoolean(const Value: Boolean);
+ procedure SetFloat(const Value: Double);
+ procedure SetInteger(const Value: Int64);
+ procedure SetString(const Value: String);
+ procedure SetVariant(const Value: Variant);
+
+ property AsObject: ISuperObject read GetObject;
+ property AsArray: ISuperArray read GetArray;
+ property AsString: String read GetString write SetString;
+ property AsInteger: Int64 read GetInteger write SetInteger;
+ property AsFloat: Double read GetFloat write SetFloat;
+ property AsBoolean: Boolean read GetBoolean write SetBoolean;
+ property AsVariant: Variant read GetVariant write SetVariant;
+ property AsDateTime: TDateTime read GetDateTime write SetDateTime;
+ property AsDate: TDate read GetDate write SetDate;
+ property AsTime: TTime read GetTime write SetTime;
+ property DataType: TDataType read GetDataType;
+ property Name: String read GetName;
+ function ToString(const Ident: Boolean = False; const UniversalTime: Boolean = False): String;
+ function ToAnsiString(const Ident: Boolean = False; const UniversalTime: Boolean = False): Ansistring;
+ end;
+
+ TCast = class(TInterfacedObject, ICast)
+ private
+ FJSON: IJSONAncestor;
+ FName: String;
+ function GetArray: ISuperArray;
+ function GetBoolean: Boolean;
+ function GetDataType: TDataType;
+ function GetFloat: Double;
+ function GetInteger: Int64;
+ function GetObject: ISuperObject;
+ function GetString: String;
+ procedure SetBoolean(const Value: Boolean);
+ procedure SetFloat(const Value: Double);
+ procedure SetInteger(const Value: Int64);
+ procedure SetString(const Value: String);
+ function GetName: String;
+ function GetVariant: Variant;
+ procedure SetVariant(const Value: Variant);
+ function GetDate: TDate;
+ function GetDateTime: TDateTime;
+ function GetTime: TTime;
+ procedure SetDate(const Value: TDate);
+ procedure SetDateTime(const Value: TDateTime);
+ procedure SetTime(const Value: TTime);
+ public
+ constructor Create(Base: IJSONAncestor); overload;
+ constructor Create(Base: IJSONPair); overload;
+ class function CreateFrom(Base: T): ICast;
+ destructor Destroy; override;
+ property AsObject: ISuperObject read GetObject;
+ property AsArray: ISuperArray read GetArray;
+ property AsString: String read GetString write SetString;
+ property AsInteger: Int64 read GetInteger write SetInteger;
+ property AsFloat: Double read GetFloat write SetFloat;
+ property AsBoolean: Boolean read GetBoolean write SetBoolean;
+ property AsVariant: Variant read GetVariant write SetVariant;
+ property AsDateTime: TDateTime read GetDateTime write SetDateTime;
+ property AsDate: TDate read GetDate write SetDate;
+ property AsTime: TTime read GetTime write SetTime;
+ property DataType: TDataType read GetDataType;
+ property Name: String read GetName;
+ function ToString(const Ident: Boolean = False; const UniversalTime: Boolean = False): String; reintroduce;
+ function ToAnsiString(const Ident: Boolean = False; const UniversalTime: Boolean = False): Ansistring;
+ end;
+
+
+
+ ISuperExpression = interface(ICast)
+ ['{58366F15-0D83-4BC5-85D5-238E78E73247}']
+ end;
+
+ TSuperExpression = class(TCast, ISuperExpression)
+ private
+ FInterpreter: TJSONInterpreter;
+ public
+ constructor Create(Base: IJSONAncestor; const Expr: String; const BlockException: Boolean = False);
+ destructor Destroy; override;
+ end;
+
+ TSuperEnumerator = record
+ Index : Integer;
+ List : TJSONEnumerator;
+ function MoveNext : Boolean;
+ function GetCurrent : ICast;
+ property Current : ICast read GetCurrent;
+ end;
+
+ ISuperObject = interface(IBaseJSON)
+ ['{B7E271F3-205B-4172-8532-BE03F2A6EDE7}']
+ procedure First;
+ procedure Next;
+ function GetEoF: Boolean;
+ function GetCount: Integer;
+ function GetCurrentKey: String;
+ function GetCurrentValue: IJSONAncestor;
+ function GetOffset: Integer;
+ function GetExpr(const Code: String): ISuperExpression;
+ function GetRaw(V: String): String;
+ procedure SetRaw(V: String; Value: String);
+
+
+ procedure Add(const Key: String; const Data: IJSONAncestor);
+ procedure SetData(V: String; Data: Variant); overload;
+ procedure SetData(V: String; Data: Variant; AFormatSettings: TFormatSettings); overload;
+ procedure Remove(Key: String);
+ function Check(const Expr: String): Boolean;
+
+ property Expression[const Code: String]: ISuperExpression read GetExpr; default;
+ property Count: Integer read GetCount;
+ property EoF: Boolean read GetEoF;
+ property CurrentKey: String read GetCurrentKey;
+ property CurrentValue: IJSONAncestor read GetCurrentValue;
+ property Offset: Integer read GetOffset;
+ function Clone: ISuperObject;
+ function GetEnumerator: TSuperEnumerator;
+ function T: TSuperObject;
+ function Where(const Cond: TCondCallBack): ISuperObject;
+ function Delete(const Cond: TCondCallBack): ISuperObject;
+ function Cast: ICast;
+ property Raw[V: String]: String read GetRaw write SetRaw;
+ end;
+
+ TSuperObject = class(TBaseJSON, ISuperObject)
+ private
+ FOffset: Integer;
+ function GetEoF: Boolean;
+ function GetCount: Integer;
+ function GetCurrentKey: String;
+ function GetCurrentValue: IJSONAncestor;
+ function GetOffset: Integer;
+ function GetExpr(const Code: String): ISuperExpression;
+ function GetRaw(V: String): String;
+ procedure SetRaw(V: String; Value: String);
+ protected
+ function GetString(V: String): String; override;
+ procedure SetNull(V: String; const Value: TMemberStatus); override;
+ public
+ procedure First;
+ procedure Next;
+
+ procedure Add(const Key: String; const Data: IJSONAncestor);
+ procedure SetData(V: String; Data: Variant); overload; inline;
+ procedure SetData(V: String; Data: Variant; AFormatSettings: TFormatSettings); overload;
+
+ class function ParseStream(Stream: TStream; CheckDate: Boolean = True): TSuperObject;
+ class function ParseFile(FileName: String; CheckDate: Boolean = True): TSuperObject;
+
+ procedure SaveTo(Stream: TStream; const Ident: Boolean = false; const UniversalTime : Boolean = false); overload; override;
+ procedure SaveTo(AFile: String; const Ident: Boolean = false; const UniversalTime : Boolean = false); overload; override;
+ procedure Remove(Key: String);
+ function Check(const Expr: String): Boolean;
+
+ property Expression[const Code: String]: ISuperExpression read GetExpr; default;
+ property Count: Integer read GetCount;
+ property Offset: Integer read GetOffset;
+ property EoF: Boolean read GetEoF;
+ property CurrentKey: String read GetCurrentKey;
+ property CurrentValue: IJSONAncestor read GetCurrentValue;
+ function GetEnumerator: TSuperEnumerator;
+ function AsType: T;
+ function T: TSuperObject; inline;
+ function Clone: ISuperObject;
+ function AsObject: ISuperObject; override;
+ function AsArray: ISuperArray; override;
+ procedure Sort(Comparison: TJSONComparison); override;
+ function Where(const Cond: TCondCallBack): ISuperObject;
+ function Delete(const Cond: TCondCallBack): ISuperObject;
+ function Cast: ICast;
+ end;
+
+ ISuperArray = interface(IBaseJSON)
+ ['{41A2D578-CFAB-4924-8F15-0D0227F35412}']
+ function GetLength: Integer;
+ property Length: Integer read GetLength;
+ procedure Add(Value: IJSONAncestor); overload;
+ procedure Add(Value: ISuperArray); overload;
+ procedure Add(Value: ISuperObject); overload;
+ procedure Add(Value: Variant; DateFormat: TFormatSettings); overload;
+ procedure Add(Value: Variant); overload;
+ procedure Delete(Index: Integer); overload;
+ procedure Clear;
+ function Clone: ISuperArray;
+ function GetEnumerator: TSuperEnumerator;
+ function T: TSuperArray;
+ function Where(const Cond: TCondCallBack): ISuperArray;
+ function Delete(const Cond: TCondCallBack): ISuperArray; overload;
+ end;
+
+ TSuperArray = class(TBaseJSON, ISuperArray)
+ private
+ function GetLength: Integer;
+ protected
+ procedure SetNull(V: Integer; const aValue: TMemberStatus); override;
+ public
+ procedure Add(Value: IJSONAncestor); overload;
+ procedure Add(Value: ISuperObject); overload;
+ procedure Add(Value: ISuperArray); overload;
+ procedure Add(Value: Variant; DateFormat: TFormatSettings); overload;
+ procedure Add(Value: Variant); overload;
+ procedure Delete(Index: Integer); overload;
+ function Delete(const Cond: TCondCallBack): ISuperArray; overload;
+ procedure Clear;
+ property Length: Integer read GetLength;
+ function GetEnumerator: TSuperEnumerator;
+ procedure SaveTo(Stream: TStream; const Ident: Boolean = false; const UniversalTime : Boolean = false); overload; override;
+ procedure SaveTo(AFile: String; const Ident: Boolean = false; const UniversalTime : Boolean = false); overload; override;
+ procedure Sort(Comparison: TJSONComparison); override;
+ function Clone: ISuperArray;
+ function AsArray: ISuperArray; override;
+ function AsObject: ISuperObject; override;
+ function Where(const Cond: TCondCallBack): ISuperArray;
+ function T: TSuperArray; inline;
+ function AsType: T;
+ end;
+
+ TSuperProperty = class(TRttiProperty)
+ public
+ ArrayRawData: Pointer;
+ end;
+
+ TSuperField = class(TRttiField)
+ public
+ ArrayRawData: Pointer;
+ end;
+
+ TSuperDynArr = class(TRttiDynamicArrayType)
+ public
+ ArrayRawData: Pointer;
+ end;
+
+ TSuperArr = class(TRttiArrayType)
+ public
+ ArrayRawData: Pointer;
+ end;
+
+ TGenericsType = (gtNil, gtList, gtObjectList);
+
+ TGenericsInfo = class
+ private
+ FContext: TRttiContext;
+ FType: TRttiType;
+ FAddMethod: TRttiMethod;
+ FCountProperty: TRttiProperty;
+ FGetItemMethod: TRttiIndexedProperty;
+ public
+ IsGeneric: Boolean;
+ Typ: TRttiType;
+ CreateArgs: TArray;
+ procedure AddVal(Instance: TObject; Val: TValue);
+ function Count(Instance: TObject): Integer;
+ function Item(Instance: TObject; const Index: Integer): TObject;
+ constructor Create(GenericClass: TClass; const AIsGeneric: Boolean; AType: TRttiType);
+ destructor Destroy; override;
+ end;
+
+ TAttributeClass = class of TCustomAttribute;
+ TPropertyGetterType = (pgtField, pgtMethod);
+
+ TSerializeParse = class
+ private
+ class var FGenericsCache: TObjectDictionary;
+ class function GetAttribute(AttributeType: TAttributeClass; Attributes: TArray): TCustomAttribute;
+ class procedure GetAliasName(const Attributes: TArray; var Result: String);
+ class function GetREVAL(const Attributues: TArray): REVAL;
+ class function IsDisabled(const Attributes: TArray): Boolean; inline;
+ class function IsDisabledRead(const Attributes: TArray): Boolean; inline;
+ class function IsDisabledWrite(const Attributes: TArray): Boolean; inline;
+ class function PropGetterType(Prop: TRttiProperty): TPropertyGetterType;
+ public
+ class constructor Create;
+ class destructor Destroy;
+ class function IsGenerics(Cls: TRttiType): Boolean; overload;
+ class function IsGenerics(Cls: TClass): Boolean; overload;
+ class function IsCollection(Cls: TRttiType): Boolean; overload;
+ class function IsCollection(Cls: TClass): Boolean; overload; inline;
+ class function GetGenericType(Cls: TClass): TGenericsType;
+ class function GetGenericsCreateArgs(Cls: TRttiType): TArray;
+
+ // ** Read
+ {$IFDEF SP_STREAM}
+ class procedure ReadStream(AStream: TStream; IResult: IJSONAncestor);
+ {$ENDIF}
+ class procedure ReadGeneric(AObject: TObject; IResult: ISuperArray);
+ class procedure ReadCollection(ACollection: TCollection; IResult: ISuperArray);
+ class procedure ReadObject(AObject: TObject; IResult: ISuperObject);
+ class procedure ReadRecord(Info: PTypeInfo; ARecord: Pointer; IResult: ISuperObject);
+ class function ReadRecordEx(Rec: T): ISuperObject;
+ class procedure ReadMembers(Data: Pointer; aType: TRttiType; IJsonData: ISuperObject);
+ class procedure ReadMember(Member: Typ; RType: PTypeInfo; MemberValue: TValue; IJsonData: IBaseJSON);
+
+ class procedure ReadSet(Val: TValue; IJsonData: ISuperArray);
+ class procedure ReadVariantOfArray(Val: Variant; IJsonData: ISuperArray);
+ class procedure ReadTValueOfArray(Val: TValue; IJsonData: ISuperArray);
+ class procedure ReadVariantOfObject(Val: Variant; const Name: String; IJsonData: ISuperObject);
+
+ // ** Write
+ {$IFDEF SP_STREAM}
+ class procedure WriteStream(AStream: TStream; IData: IJSONAncestor);
+ {$ENDIF}
+ class procedure WriteGeneric(AObject: TObject; IData: ISuperArray);
+ class procedure WriteCollection(ACollection: TCollection; IData: ISuperArray);
+ class procedure WriteObject(AObject: TObject; IData: ISuperObject);
+ class procedure WriteRecord(Info: PTypeInfo; ARecord: Pointer; IData: ISuperObject);
+ class procedure WriteRecordEx(Rec: T; IData: ISuperObject);
+ class procedure WriteMembers(Data: Pointer; aType: TRttiType; IJsonData: ISuperObject);
+ class procedure WriteMember(Data: Pointer; Member: Typ; RType: PTypeInfo; MemberValue: TRttiObject; IJsonData: IBaseJSON);
+ class procedure WriteSet(Data: Pointer; Member: TRttiObject; IJSONData: ISuperArray);
+ class procedure SetValue(var Data: Pointer; Member: TRttiObject; MIdx: Typ; Val: TValue);
+ class function GetValue(Data: Pointer; Member: TRttiObject; MIdx: Typ): TValue;
+ class function GetMemberTypeInfo(Member: TRttiObject; const GetArray: Boolean = true): PTypeInfo; inline;
+ class function GetMemberType(Member: TRttiObject; const GetArray: Boolean = true): TRttiType; //inline;
+ class function GetArrayRawData(Member: TRttiObject): Pointer;
+ class procedure SetArrayRawData(Member: TRttiObject; RawData: Pointer);
+ class procedure ClearArrayRawData(Member: TRttiObject);
+
+ class function ObjectConstructorParamCount(Instance: TClass): Integer;
+ class function ObjectConstructor(Instance: TClass): TObject;
+ class function CheckObject(Data: Pointer; Member: TRttiObject; MIdx: Typ; var Obj: TObject): Boolean;
+
+ class property GenericsCache: TObjectDictionary read FGenericsCache;
+ end;
+
+ TMemberVisibilities = set of TMemberVisibility;
+ TSerializeParseOptions = class
+ private
+ class var FVisibilities: TMemberVisibilities;
+ public
+ class constructor Create;
+ class property Visibilities: TMemberVisibilities read FVisibilities write FVisibilities;
+ end;
+
+ TSuperObjectHelper = class helper for TObject
+ public
+ function AsJSON(const Ident: Boolean = False; const UniversalTime: Boolean = False): String;
+ function AsJSONObject: ISuperObject;
+ procedure AssignFromJSON(const JSON: String); overload;
+ procedure AssignFromJSON(JSON: ISuperObject); overload;
+ constructor FromJSON(const JSON: String); overload;
+ constructor FromJSON(JSON: ISuperObject); overload;
+ constructor FromJSON(const JSON: String; CreateArgs: Array of TValue; const ConstructMethod: String = 'Create'); overload;
+ constructor FromJSON(const JSON: ISuperObject; CreateArgs: Array of TValue; const ConstructMethod: String = 'Create'); overload;
+ end;
+
+ TBaseSuperRecord = class
+ public
+ class function AsJSON(Rec: T): String;
+ class function AsJSONObject(Rec: T): ISuperObject;
+ class function FromJSON(JSON: String): T; overload;
+ class function FromJSON(JSON: ISuperObject): T; overload;
+ end;
+ TSuperRecord = class(TBaseSuperRecord);
+
+ TJSON = class
+ public
+ class function Parse(const Value: String): T; overload;
+ class function Parse(JSON: ISuperObject): T; overload;
+ class function Parse(JSON: ISuperArray): T; overload;
+ class function SuperObject(Value: T): ISuperObject; overload;
+ {$IFDEF SP_DATASET}
+ class function SuperObject(Value: TDataSet): ISuperObject; overload;
+ class function Stringify(Value: TDataSet): String; overload;
+ {$ENDIF}
+ class function SuperObject(Value: TValue): ISuperObject; overload;
+ class function Stringify(Value: T; Indent: Boolean = False; UniversalTime: Boolean = True): String; overload;
+ class function Stringify(Value: TValue; Indent: Boolean = False; UniversalTime: Boolean = True): String; overload;
+ end;
+
+ function SO(JSON: String = '{}'): ISuperObject; overload;
+ function SO(const Args: array of const): ISuperObject; overload;
+ function SA(JSON: String = '[]'): ISuperArray; overload;
+ function SA(const Args: array of const): ISuperArray; overload;
+
+implementation
+
+var GenericsUnit : String;
+
+function SO(JSON: String): ISuperObject;
+begin
+ if JSON = '' then JSON := '{}';
+ Result := TSuperObject.Create(JSON);
+end;
+
+function SO(const Args: array of const): ISuperObject;
+var
+ I: Integer;
+ Members: ISuperArray;
+begin
+ Result := TSuperObject.Create;
+ Members := SA(Args);
+ if Odd(Members.Length) then
+ Assert(False);
+ for I := 0 to (Members.Length div 2) - 1 do
+ Result.Add(Members.S[I*2], Members.Ancestor[(I*2)+1]);
+end;
+
+function SA(JSON: String): ISuperArray;
+begin
+ Result := TSuperArray.Create(JSON);
+end;
+
+function SA(const Args: array of const): ISuperArray;
+var
+ I: Integer;
+ SArray: ISuperArray;
+ SObject: ISuperObject;
+begin
+ Result := TSuperArray.Create;
+ for I := 0 to High(Args) do
+ case PVarRec(@Args[I]).VType of
+ vtInteger : Result.Add(TJSONInteger.Create(PVarRec(@Args[I]).VInteger));
+ vtInt64 : Result.Add(TJSONInteger.Create(PVarRec(@Args[I]).VInt64^));
+ vtBoolean : Result.Add(TJSONBoolean.Create(PVarRec(@Args[I]).VBoolean));
+ {$IFNDEF NEXTGEN}
+ vtChar : Result.Add(TJSONString.Create(PVarRec(@Args[I]).VWideChar));
+ vtString : Result.Add(TJSONString.Create(String(PVarRec(@Args[I]).VString^)));
+ vtPChar : Result.Add(TJSONString.Create(Char(PVarRec(@Args[I]).VPChar^)));
+ vtAnsiString: Result.Add(TJSONString.Create(String(PVarRec(@Args[I]).VAnsiString)));
+ {$ENDIF}
+ vtWideChar: Result.Add(TJSONString.Create(PVarRec(@Args[I]).VWideChar));
+ vtExtended: Result.Add(TJSONFloat.Create(PVarRec(@Args[I]).VExtended^));
+ vtCurrency: Result.Add(TJSONFloat.Create(PVarRec(@Args[I]).VCurrency^));
+ vtWideString: Result.Add(TJSONString.Create(PWideChar(PVarRec(@Args[I]).VWideString)));
+ vtUnicodeString: Result.Add(TJSONString.Create(String(PVarRec(@Args[I]).VUnicodeString)));
+ vtInterface:
+ if PVarRec(@Args[I]).VInterface = nil then
+ Result.Add(TJSONNull.Create(False))
+ else if IInterface(PVarRec(@Args[I]).VInterface).QueryInterface(ISuperObject, SObject) = 0 then
+ Result.Add(SObject)
+ else if IInterface(PVarRec(@Args[I]).VInterface).QueryInterface(ISuperArray, SArray) = 0 then
+ Result.Add(SArray)
+ else
+ Assert(False);
+ vtPointer :
+ if PVarRec(@Args[I]).VPointer = nil then
+ Result.Add(TJSONNull.Create(False))
+ else
+ Result.Add(TJSONInteger.Create(NativeInt(PVarRec(@Args[I]).VPointer)));
+ vtVariant:
+ Result.Add(PVarRec(@Args[I]).VVariant^);
+ vtObject:
+ if PVarRec(@Args[I]).VPointer = nil then
+ Result.Add(TJSONNull.Create(False))
+ else
+ Result.Add(TJSONInteger.Create(NativeInt(PVarRec(@Args[I]).VPointer)));
+ vtClass:
+ if PVarRec(@Args[I]).VPointer = nil then
+ Result.Add(TJSONNull.Create(False))
+ else
+ Result.Add(TJSONInteger.Create(NativeInt(PVarRec(@Args[I]).VPointer)));
+ else
+ Assert(false);
+ end;
+end;
+
+{ TSuperObject }
+
+
+
+constructor TBaseJSON.Create(JSON: String; const CheckDate: Boolean);
+type PInterface = ^IInterface;
+var
+ JVal: IJSONAncestor;
+ PIntf: PInterface;
+begin
+ FCheckDate := CheckDate;
+ if (Self.InheritsFrom(TSuperArray)) and (Trim(JSON) = '{}') then JSON := '[]';
+ JVal := TJSONObject.ParseJSONValue(JSON, FCheckDate);
+ if JVal.QueryInterface(GetTypeData(TypeInfo(T)).Guid, FJSONObj) = S_OK then
+ FInterface := TValue.From(FJSONObj).AsInterface
+ else
+ FCasted := JVal
+end;
+
+function TBaseJSON.GetValue(const Name: Typ): C;
+begin
+ if Self.InheritsFrom(TSuperObject) then
+ with TJSONObject(FInterface).Get(PString(@Name)^) do
+ if JsonValue is TJSONNull then
+ Result := Nil
+ else
+ Result := JSonValue as C
+ else
+ if Self.InheritsFrom(TSuperArray) then
+ Result := TJSONArray(FInterface).Get(PInteger(@Name)^) as C
+ else
+ Result := Nil;
+end;
+
+function TBaseJSON.GetVariant(V: Typ): Variant;
+begin
+ case GetType(V) of
+ varString: Result := S[V];
+ varInt64: Result := I[V];
+ varDouble: Result := F[V];
+ varBoolean: Result := B[V];
+ varDate: Result := D[V];
+ else
+ Result := Variants.Null;
+ end;
+end;
+
+function TBaseJSON.Member(const Name: Typ): Boolean;
+begin
+ if Self.InheritsFrom(TSuperObject) then
+ Result := Assigned(TJSONObject(FInterface).Get(PString(@Name)^))
+ else
+ Result := Assigned(TJSONArray(FInterface).Get(PInteger(@Name)^))
+end;
+
+procedure TBaseJSON.Member(const Name: Typ; const Value: TValue);
+var
+ Pair: IJSONPair;
+begin
+ if Self.InheritsFrom(TSuperObject) then
+ begin
+ Pair := TJSONObject(FInterface).Get(PString(@Name)^);
+ if not Assigned(Pair) then
+ begin
+ TJSONObject(FInterface).AddPair(PString(@Name)^, DefaultValueClass(Value) as TJSONAncestor );
+ Exit;
+ end;
+ if Assigned(Pair.JsonValue) then
+ Pair.JsonValue := Nil;
+ Pair.JsonValue := DefaultValueClass(Value) as TJSONAncestor;
+ end
+ else
+ begin
+ if TJSONArray(FInterface).Count - 1 < PInteger(@Name)^ then
+ while TJSONArray(FInterface).Count - 1 < PInteger(@Name)^ do
+ TJSONArray(FInterface).Add(DefaultValueClass(Value) as TJSONAncestor)
+ else
+ TJSONArray(FInterface).Index[PInteger(@Name)^] := DefaultValueClass(Value) as TJSONAncestor
+ end;
+end;
+
+function TBaseJSON.AsJSON(const Ident, UniversalTime: Boolean): String;
+var
+ SBuild: TJSONWriter;
+begin
+ try
+ SBuild := TJSONWriter.Create(Ident, UniversalTime);
+ if Assigned(FCasted) then
+ FCasted.AsJSONString(SBuild)
+ else
+ TJSONAncestor(FInterface).AsJSONString(SBuild);
+ Result := SBuild.ToString;
+ finally
+ SBuild.Free;
+ end;
+
+end;
+
+function TBaseJSON.Contains(Key: Typ): Boolean;
+begin
+ Result := GetData(Key) <> Nil;
+end;
+
+function TBaseJSON.ContainsEx(Key: Typ; out Value: IJSONAncestor): Boolean;
+begin
+ Value := GetData(Key);
+ Result := Value <> Nil;
+end;
+
+constructor TBaseJSON.Create(JSON: T; const CheckDate: Boolean = True);
+begin
+ FJSONObj := JSON;
+ FCasted := nil;
+ FCheckDate := CheckDate;
+ FInterface := TValue.From(JSON).AsInterface;
+end;
+
+constructor TBaseJSON.CreateCasted(Value: IJSONAncestor; const CheckDate: Boolean);
+begin
+// FJSONObj := Nil;
+ FInterface := Nil;
+ FCasted := Value;
+ FCheckDate := CheckDate;
+end;
+
+constructor TBaseJSON.CreateWithEscape(JSON: String; const CheckDate: Boolean);
+begin
+ Create(LimitedStrToUTF16(JSON), CheckDate);
+end;
+
+function TBaseJSON.DefaultValueClass(const Value): TT;
+var
+ r: TRttiContext;
+ ty: TRttiType;
+begin
+ if TJSONString.InheritsFrom(TT) then
+ Result := TJSONString.Create(String(Value)) as TT
+ else if TJSONInteger.InheritsFrom(TT) then
+ Result := TJSONInteger.Create(Int64(Value)) as TT
+ else if TJSONFloat.InheritsFrom(TT) then
+ Result := TJSONFloat.Create(Double(Value)) as TT
+ else if TJSONBoolean.InheritsFrom(TT) then
+ Result := TJSONBoolean.Create(Boolean(Value)) as TT
+ else if TJSONNull.InheritsFrom(TT) then
+ Result := TJSONNull.Create(Boolean(Value)) as TT
+ else if TJSONDateTime.InheritsFrom(TT) then
+ Result := TJSONDateTime.Create(TDateTime(Value)) as TT
+ else if TJSONDate.InheritsFrom(TT) then
+ Result := TJSONDate.Create(TDate(Value)) as TT
+ else if TJSONTime.InheritsFrom(TT) then
+ Result := TJSONTime.Create(TTime(Value)) as TT
+ else if TJSONRaw.InheritsFrom(TT) then
+ Result := TJSONRaw.Create(String(Value)) as TT
+ else if TJSONArray.InheritsFrom(TT) then
+ begin
+ if Pointer(Value) <> Nil then
+ Exit(TJSONArray(ISuperArray(Value)) as TT);
+ Result := TJSONArray.Create as TT;
+ end
+ else if TJSONObject.InheritsFrom(TT) then
+ begin
+ if Pointer(Value) <> Nil then
+ Exit(TJSONObject(ISuperObject(Value)) as TT);
+ Result := TJSONObject.Create as TT;
+ end
+ else
+ begin
+ r := TRttiContext.Create;
+ ty := r.GetType(TClass(TT));
+ if ty = nil then
+ exit(Nil);
+ try
+ Result := TT(ty.GetMethod('Create').Invoke(ty.AsInstance.MetaclassType, []).AsObject);
+ except
+ if Assigned(ty) then
+ ty.Free;
+ raise;
+ end;
+ r.Free;
+ end;
+end;
+
+destructor TBaseJSON.Destroy;
+begin
+ inherited;
+end;
+
+function TBaseJSON.GetBoolean(V: Typ): Boolean;
+begin
+ Result := False;
+ if Member(V) then
+ Result := GetValue(V).ValueEx;
+end;
+
+function TBaseJSON.GetData(Key: Typ): IJSONAncestor;
+var
+ P: IJsonPair;
+begin
+ if Self.InheritsFrom(TSuperObject) then
+ begin
+ P := TJSONObject(FInterface).Get(PString(@Key)^);
+ if Assigned(P) then
+ Result := P.JsonValue
+ else
+ Result := Nil
+ end
+ else
+ if Self.InheritsFrom(TSuperArray) then
+ Result := TJSONArray(FInterface).Get(PInteger(@Key)^);
+end;
+
+function TBaseJSON.GetDataType: TDataType;
+var
+ Cast: ICast;
+begin
+ if TValue.From(FJSONObj).AsInterface <> nil then
+ Cast := TCast.CreateFrom(FJSONObj)
+ else
+ if Assigned(FCasted) then
+ Cast := TCast.Create(FCasted)
+ else
+ Exit(dtNil);
+ Result := Cast.DataType
+end;
+
+function TBaseJSON.GetDate(V: Typ): TDate;
+begin
+ Result := 0;
+ if Member(V) then
+ Result := GetValue(V).Value;
+end;
+
+function TBaseJSON.GetDateTime(V: Typ): TDateTime;
+begin
+ Result := 0;
+ if Member(V) then
+ Result := GetValue(V).Value;
+end;
+
+function TBaseJSON.GetDouble(V: Typ): Double;
+begin
+ Result := 0;
+ if Member(V) then
+ if GetType(V) = varInt64 then
+ Result := GetValue(V).ValueEx
+ else
+ Result := GetValue(V).ValueEx;
+end;
+
+function TBaseJSON.GetInteger(V: Typ): Int64;
+begin
+ Result := 0;
+ if Member(V) then
+ Result := GetValue(V).ValueEx;
+end;
+
+function TBaseJSON.GetNull(V: Typ): TMemberStatus;
+var
+ Val: IJSONAncestor;
+begin
+ if ContainsEx(V, Val) then begin
+ if Val is TJSONNull then
+ Result := jNull
+ else
+ Result := jAssigned
+ end else
+ Result := jUnAssigned;
+end;
+
+function TBaseJSON.GetArray(V: Typ): ISuperArray;
+var
+ J: IJSONArray;
+begin
+ Result := Nil;
+ if not Member(V) then
+ Member(V, nil);
+ J := GetValue(V);
+ Result := TSuperArray.Create(J);
+end;
+
+function TBaseJSON.GetObject(V: Typ): ISuperObject;
+begin
+ Result := Nil;
+ if not Member(V) then
+ Member(V, Nil);
+
+ Result := TSuperObject.Create(GetValue(V));
+end;
+
+function TBaseJSON.GetAncestor(V: Typ): IJSONAncestor;
+begin
+ Result := GetData(V);
+end;
+
+function TBaseJSON.GetString(V: Typ): String;
+label
+ JMP;
+begin
+ Result := '';
+ if Member(V) then
+ if FCheckDate then
+ case Ancestor[V].DataType of
+ dtDateTime : Result := GetValue(V).GetAsString;
+ dtDate : Result := GetValue(V).GetAsString;
+ dtTime : Result := GetValue(V).GetAsString;
+ else
+ goto JMP;
+ end
+ else
+ JMP: Result := GetValue(V).ValueEx;
+end;
+
+function TBaseJSON.GetTime(V: Typ): TTime;
+begin
+ Result := 0;
+ if Member(V) then
+ Result := GetValue(V).Value;
+end;
+
+function TBaseJSON.GetType(Key: Typ): TVarType;
+var
+ Temp: IJSONAncestor;
+begin
+ Temp := GetData(Key);
+ if Temp = Nil then
+ Result := varUnknown
+ else if Temp is TJSONString then
+ Result := varString
+ else if Temp is TJSONFloat then
+ Result := varDouble
+ else if Temp is TJSONInteger then
+ Result := varInt64
+ else if Temp is TJSONNull then
+ Result := varNull
+ else if Temp is TJSONObject then
+ Result := varObject
+ else if Temp is TJSONArray then
+ Result := varArray
+ else if Temp is TJSONBoolean then
+ Result := varBoolean
+ else if (Temp is TJSONDateTime) or (Temp is TJSONDate) or (Temp is TJSONTime) then
+ Result := varDate
+end;
+
+procedure TBaseJSON.SetArray(V: Typ; const Value: ISuperArray);
+begin
+ Member(V, Value.Self )
+end;
+
+procedure TBaseJSON.SetBoolean(V: Typ; const Value: Boolean);
+begin
+ Member(V, Value)
+end;
+
+procedure TBaseJSON.SetDate(V: Typ; const Value: TDate);
+begin
+ Member(V, Value);
+end;
+
+procedure TBaseJSON.SetDateTime(V: Typ; const Value: TDateTime);
+begin
+ Member(V, Value);
+end;
+
+procedure TBaseJSON.SetDouble(V: Typ; const Value: Double);
+begin
+ Member(V, Value);
+end;
+
+procedure TBaseJSON.SetInteger(V: Typ; const Value: Int64);
+begin
+ Member(V, Value);
+end;
+
+procedure TBaseJSON.SetNull(V: Typ; const Value: TMemberStatus);
+begin
+end;
+
+procedure TBaseJSON.SetObject(V: Typ; const Value: ISuperObject);
+begin
+ Member(V, Value.Self )
+end;
+
+procedure TBaseJSON.SetString(V: Typ; const Value: String);
+var
+ Anc: IJSONAncestor;
+ dT: TDateTime;
+ ValType: TDataType;
+label
+ JMP, JERR;
+begin
+ if FCheckDate then
+ begin
+ Anc := Ancestor[V];
+ if Assigned(Anc) and (Anc.DataType in [dtDateTime..dtTime]) then
+ begin
+ if not TJSONDateManager.Check(Value, dT, ValType ) then
+ JERR: raise SOInvalidDate.Create('Invalid date format.')
+ else
+ case ValType of
+ dtDateTime: Member(V, dT);
+ dtDate: Member(V, TDate(dT));
+ dtTime: Member(V, TTime(dT));
+ else
+ goto JERR;
+ end;
+ end
+ else
+ goto JMP;
+ end
+ else
+ JMP: Member(V, Value);
+end;
+
+procedure TBaseJSON.SetTime(V: Typ; const Value: TTime);
+begin
+ Member(V, Value);
+end;
+
+procedure TBaseJSON.SetVariant(V: Typ; const Value: Variant);
+var
+ VTyp: TVarType;
+begin
+ if VarIsNull(Value) then
+ Null[V] := jNull
+ else
+ begin
+ VTyp := GetType(V);
+ if VTyp = varUnknown then
+ VTyp := VarType(Value);
+ case VTyp of
+ varString, varUString:
+ S[V] := Value;
+ varInt64, varInteger, varByte:
+ I[V] := Value;
+ varDouble, varCurrency:
+ F[V] := Value;
+ varBoolean:
+ B[V] := Value;
+ varDate:
+ D[V] := Value;
+ varNull:
+ Null[V] := jNull;
+ end;
+ end;
+end;
+
+function TBaseJSON.GetSelf: T;
+begin
+ Result := FJSONObj;
+end;
+
+
+{ TSuperObject }
+
+function TSuperObject.AsArray: ISuperArray;
+begin
+ if not Assigned(FCasted) or not (FCasted is TJSONArray) then
+ Exit(Nil);
+ Result := TSuperArray.Create(IJSONArray(FCasted));
+end;
+
+function TSuperObject.AsObject: ISuperObject;
+begin
+ Result := Self;
+end;
+
+function TSuperObject.Check(const Expr: String): Boolean;
+var
+ IExpr: ISuperExpression;
+begin
+ IExpr := TSuperExpression.Create(FJSONObj, Expr, True);
+ Result := IExpr.DataType <> dtNil;
+end;
+
+function TSuperObject.AsType: T;
+begin
+ Result := TJSON.Parse(Self);
+end;
+
+function TSuperObject.Cast: ICast;
+begin
+ if Assigned(FCasted) then
+ Result := TCast.Create(FCasted)
+ else
+ Result := TCast.Create(FJSONObj);
+end;
+
+function TSuperObject.Clone: ISuperObject;
+begin
+ Result := SO(AsJSON);
+end;
+
+function TSuperObject.Delete(const Cond: TCondCallBack): ISuperObject;
+var
+ Member: IJSONPair;
+begin
+ Result := Self;
+ if not Assigned(Cond) then
+ Exit;
+ for Member in FJSONObj do
+ if Cond(TCast.Create(Member)) then
+ Result.Self.Remove(Member);
+end;
+
+procedure TSuperObject.First;
+begin
+ FOffset := 0;
+end;
+
+function TSuperObject.GetCount: Integer;
+begin
+ Result := FJSONObj.Count;
+end;
+
+function TSuperObject.GetCurrentKey: String;
+begin
+ Result := FJSONObj.Get(FOffset).Name;
+end;
+
+function TSuperObject.GetCurrentValue: IJSONAncestor;
+begin
+ Result := FJSONObj.Get(FOffset).JsonValue;
+end;
+
+function TSuperObject.GetEnumerator: TSuperEnumerator;
+begin
+ Result.Index := -1;
+ Result.List := TJSONObject(FJSONObj).GetEnumerator
+end;
+
+function TSuperObject.GetEoF: Boolean;
+begin
+ Result := FOffset > Count - 1;
+end;
+
+function TSuperObject.GetExpr(const Code: String): ISuperExpression;
+begin
+ Result := TSuperExpression.Create(FJSONObj, Code);
+end;
+
+
+function TSuperObject.GetOffset: Integer;
+begin
+ Result := FOffset;
+end;
+
+function TSuperObject.GetRaw(V: String): String;
+begin
+ Result := GetValue(V).ValueEx;
+end;
+
+function TSuperObject.GetString(V: String): String;
+begin
+ Result := inherited GetString(V);
+end;
+
+procedure TSuperObject.Next;
+begin
+ Inc(FOffset);
+end;
+
+class function TSuperObject.ParseFile(FileName: String; CheckDate: Boolean): TSuperObject;
+var
+ Strm: TFileStream;
+begin
+ Strm := TFileStream.Create(FileName, fmOpenRead, fmShareDenyWrite);
+ try
+ Result := ParseStream(Strm, CheckDate);
+ finally
+ Strm.Free;
+ end;
+end;
+
+class function TSuperObject.ParseStream(Stream: TStream; CheckDate: Boolean): TSuperObject;
+var
+ Strm: TStringStream;
+begin
+ Strm := TStringStream.Create;
+ try
+ Strm.LoadFromStream(Stream);
+ Result := TSuperObject.Create(Strm.DataString, CheckDate);
+ finally
+ Strm.Free;
+ end;
+end;
+
+procedure TSuperObject.Remove(Key: String);
+begin
+ FJSONObj.Remove(Key);
+end;
+
+procedure TSuperObject.SaveTo(Stream: TStream; const Ident, UniversalTime: Boolean);
+var
+ S: TStringStream;
+begin
+ S := TStringStream.Create( AsJSON(Ident, UniversalTime) );
+ try
+ S.SaveToStream(Stream);
+ finally
+ S.Free;
+ end;
+end;
+
+procedure TSuperObject.SaveTo(AFile: String; const Ident, UniversalTime: Boolean);
+var
+ S: TStringStream;
+begin
+ S := TStringStream.Create( AsJSON(Ident, UniversalTime) );
+ try
+ S.SaveToFile(AFile);
+ finally
+ S.Free;
+ end;
+end;
+
+procedure TSuperObject.Add(const Key: String; const Data: IJSONAncestor);
+begin
+ FJSONObj.AddPair(Key, Data);
+end;
+
+procedure TSuperObject.SetData(V: String; Data: Variant; AFormatSettings: TFormatSettings);
+begin
+ case VarType(Data) of
+ varNull:
+ FJSONObj.AddPair(V, TJSONNull.Create(True));
+
+ varDate:
+ FJSONObj.AddPair(V, TJSONString.Create(DateTimeToStr(TDateTime(Data), AFormatSettings)));
+
+ varInteger:
+ FJSONObj.AddPair(V, TJSONInteger.Create(Integer(Data)));
+
+ varBoolean:
+ FJSONObj.AddPair(V, TJSONBoolean.Create(Data));
+
+ varString, varUString:
+ FJSONObj.AddPair(V, TJSONString.Create(String(Data)));
+
+ varDouble:
+ FJSONObj.AddPair(V, TJSONFloat.Create(Double(Data)));
+
+ vtCurrency:
+ FJSONObj.AddPair(V, TJSONFloat.Create(Currency(Data)));
+
+ varInt64: FJSONObj.AddPair(V, TJSONInteger.Create(Int64(Data)));
+ end;
+end;
+
+procedure TSuperObject.SetNull(V: String; const Value: TMemberStatus);
+var
+ Val: IJSONAncestor;
+begin
+ if Value = jAssigned then
+ Exit;
+ with TJSONObject(FJSONObj) do begin
+ if ContainsEx(V, Val) then
+ begin
+ case Value of
+ jUnAssigned:
+ Remove(V);
+ jNull: begin
+ Remove(V);
+ AddPair(V, TJSONNull.Create(True));
+ end;
+ end;
+ end
+ else
+ AddPair(V, TJSONNull.Create(True));
+ end;
+end;
+
+procedure TSuperObject.SetRaw(V, Value: String);
+begin
+ Member(V, Value);
+end;
+
+procedure TSuperObject.Sort(Comparison: TJSONComparison);
+begin
+ if not Assigned(Comparison) then Exit;
+ FJSONObj.Sort(function(Left, Right: IJSONPair): Integer
+ begin
+ Result := Comparison(TCast.Create(Left), TCast.Create(Right));
+ end);
+end;
+
+function TSuperObject.T: TSuperObject;
+begin
+ Result := Self;
+end;
+
+function TSuperObject.Where(const Cond: TCondCallBack): ISuperObject;
+var
+ Member: IJSONPair;
+begin
+ Result := TSuperObject.Create('{}', FCheckDate);
+ if not Assigned(Cond) then
+ Exit;
+ for Member in FJSONObj do
+ if Cond(TCast.Create(Member)) then
+ Result.Self.AddPair(Member);
+end;
+
+procedure TSuperObject.SetData(V: String; Data: Variant);
+begin
+ SetData(V, Data, FormatSettings);
+end;
+
+{ TSuperArray }
+
+procedure TSuperArray.Add(Value: Variant; DateFormat: TFormatSettings);
+begin
+ if VarIsNull(Value) then
+ begin
+ TJSONArray(FJSONObj).Add(TJSONNull.Create(True));
+ Exit;
+ end;
+
+ case VarType(Value) of
+ varDate :
+ TJSONArray(FJSONObj).Add(TJSONString.Create(DateTimeToStr(TDateTime(Value), DateFormat)));
+
+ varBoolean:
+ TJSONArray(FJSONObj).Add(TJSONBoolean.Create(Value));
+
+ else
+ with TValue.FromVariant(Value) do
+ case Kind of
+ tkInteger, tkInt64:
+ TJSONArray(FJSONObj).Add(TJSONInteger.Create(Int64(Value)));
+
+ tkFloat:
+ TJSONArray(FJSONObj).Add(TJSONFloat.Create(Double(Value)));
+
+ tkString, tkWChar, tkLString, tkWString, tkUString, tkChar:
+ TJSONArray(FJSONObj).Add(TJSONString.Create(Value));
+ end;
+ end;
+
+end;
+
+procedure TSuperArray.Add(Value: Variant);
+begin
+ Add(Value, FormatSettings);
+end;
+
+function TSuperArray.AsArray: ISuperArray;
+begin
+ Result := Self;
+end;
+
+function TSuperArray.AsObject: ISuperObject;
+begin
+ Result := TSuperObject.CreateCasted(FJSONObj);
+end;
+
+function TSuperArray.AsType: T;
+var
+ Ctx: TRttiContext;
+ Typ: TRttiType;
+begin
+ Ctx := TRttiContext.Create;
+ try
+ Typ := Ctx.GetType(TypeInfo(T));
+ if not Assigned(Typ) then
+ Exit;
+ if Typ.IsInstance then begin
+ if TSerializeParse.IsGenerics(Typ) then begin
+ Result := TValue.From(TSerializeParse.ObjectConstructor(Typ.AsInstance.MetaclassType)).AsType;
+ TSerializeParse.WriteGeneric(TValue.From(Result).AsObject, Self);
+ Exit;
+ end else if TSerializeParse.IsCollection(Typ) then begin
+ Result := TValue.From(TSerializeParse.ObjectConstructor(Typ.AsInstance.MetaclassType)).AsType;
+ TSerializeParse.WriteCollection(TValue.From(Result).AsObject as TCollection, Self);
+ Exit;
+ end;
+ end;
+ raise SOException.Create('Unsupported type.');
+ except
+ Ctx.Free;
+ raise;
+ end;
+end;
+
+procedure TSuperArray.Add(Value: IJSONAncestor);
+begin
+ TJSONArray(FJSONObj).Add(Value);
+end;
+
+procedure TSuperArray.Clear;
+begin
+ FJSONObj.Clear;
+end;
+
+function TSuperArray.Clone: ISuperArray;
+begin
+ Result := SA(AsJSON);
+end;
+
+function TSuperArray.Delete(const Cond: TCondCallBack): ISuperArray;
+var
+ Member: IJSONAncestor;
+begin
+ Result := Self;
+ if not Assigned(Cond) then
+ Exit;
+ for Member in FJSONObj do
+ if Cond(TCast.Create(Member)) then
+ Result.Self.Remove(Member);
+end;
+
+procedure TSuperArray.Delete(Index: Integer);
+begin
+ TJsonArray(FJSONObj).Remove(Index);
+end;
+
+function TSuperArray.GetEnumerator: TSuperEnumerator;
+begin
+ Result.Index := -1;
+ Result.List := TJSONArray(FJSONObj).GetEnumerator
+end;
+
+function TSuperArray.GetLength: Integer;
+begin
+ Result := TJSONArray(FJSONObj).Count;
+end;
+
+procedure TSuperArray.SaveTo(Stream: TStream; const Ident, UniversalTime: Boolean);
+var
+ S: TStringStream;
+begin
+ S := TStringStream.Create( AsJSON(Ident, UniversalTime) );
+ try
+ S.SaveToStream(S);
+ finally
+ S.Free;
+ end;
+end;
+
+procedure TSuperArray.SaveTo(AFile: String; const Ident, UniversalTime: Boolean);
+var
+ S: TStringStream;
+begin
+ S := TStringStream.Create( AsJSON(Ident, UniversalTime) );
+ try
+ S.SaveToFile(AFile);
+ finally
+ S.Free;
+ end;
+end;
+
+procedure TSuperArray.SetNull(V: Integer; const aValue: TMemberStatus);
+var
+ Val: IJSONAncestor;
+begin
+ if aValue = jAssigned then
+ Exit;
+ with FJSONObj do begin
+ if ContainsEx(V, Val) then
+ begin
+ case aValue of
+ jUnAssigned:
+ Remove(V);
+ jNull: begin
+ Index[V] := TJSONNull.Create(True);
+ end;
+ end;
+ end
+ else
+ Member(V, True);
+ end;
+end;
+
+procedure TSuperArray.Sort(Comparison: TJSONComparison);
+begin
+ if not Assigned(Comparison) then Exit;
+ FJSONObj.Sort(function(Left, Right: IJSONAncestor): Integer
+ begin
+ Result := Comparison(TCast.Create(Left), TCast.Create(Right));
+ end);
+end;
+
+function TSuperArray.T: TSuperArray;
+begin
+ Result := Self;
+end;
+
+function TSuperArray.Where(const Cond: TCondCallBack): ISuperArray;
+var
+ Member: IJSONAncestor;
+begin
+ Result := TSuperArray.Create('[]', FCheckDate);
+ if not Assigned(Cond) then
+ Exit;
+ for Member in FJSONObj do
+ if Cond(TCast.Create(Member)) then
+ Result.Self.Add(Member);
+end;
+
+procedure TSuperArray.Add(Value: ISuperObject);
+begin
+ Add(Value.Self);
+end;
+
+procedure TSuperArray.Add(Value: ISuperArray);
+begin
+ Add(Value.Self);
+end;
+
+{ TSuperObjectHelper }
+
+function TSuperObjectHelper.AsJSON(const Ident: Boolean = False; const UniversalTime: Boolean = False): String;
+begin
+ Result := AsJSONObject.AsJSON(Ident, UniversalTime);
+end;
+
+constructor TSuperObjectHelper.FromJSON(const JSON: String);
+begin
+ FromJSON(JSON, []);
+end;
+
+function TSuperObjectHelper.AsJSONObject: ISuperObject;
+var
+ IResult: ISuperObject;
+begin
+ try
+ IResult := TSuperObject.Create;
+ TSerializeParse.ReadObject(Self, IResult);
+ finally
+ Result := IResult;
+ end;
+end;
+
+procedure TSuperObjectHelper.AssignFromJSON(const JSON: String);
+begin
+ TSerializeParse.WriteObject(Self, SO(JSON));
+end;
+
+procedure TSuperObjectHelper.AssignFromJSON(JSON: ISuperObject);
+begin
+ TSerializeParse.WriteObject(Self, JSON);
+end;
+
+constructor TSuperObjectHelper.FromJSON(const JSON: String; CreateArgs: array of TValue; const ConstructMethod: String);
+var
+ IData: ISuperObject;
+begin
+ IData := TSuperObject.Create(JSON);
+ FromJSON(IData, CreateArgs, ConstructMethod);
+end;
+
+constructor TSuperObjectHelper.FromJSON(const JSON: ISuperObject; CreateArgs: array of TValue; const ConstructMethod: String);
+var
+ Ctx: TRttiContext;
+ Typ: TRttiType;
+ Method: TRttiMethod;
+begin
+ Ctx := TRttiContext.Create;
+ try
+ Typ := Ctx.GetType(ClassType);
+ if not Assigned(Typ) then Exit;
+ Method := Typ.GetMethod(ConstructMethod);
+ if (not Assigned(Method)) or not Method.IsConstructor then Exit;
+ Method.Invoke(Self, CreateArgs);
+ finally
+ Ctx.Free;
+ TSerializeParse.WriteObject(Self, JSON);
+ end;
+end;
+
+constructor TSuperObjectHelper.FromJSON(JSON: ISuperObject);
+begin
+ FromJSON(JSON, []);
+end;
+
+{ TSerializeParse }
+
+class procedure TSerializeParse.ReadMembers(Data: Pointer; aType: TRttiType; IJsonData: ISuperObject);
+var
+ Prop: TRttiProperty;
+ Field: TRttiField;
+ MemberName: String;
+ RevalAttribute: REVAL;
+ Value: TValue;
+ Attributes: TArray;
+begin
+ for Prop in aType.GetProperties do
+ begin
+ if (not (Prop.Visibility in TSerializeParseOptions.Visibilities))
+ {$IFDEF AUTOREFCOUNT} or (Prop.Parent.AsInstance.MetaclassType = TObject){$ENDIF}
+ or (Prop.Parent.AsInstance.MetaclassType = TCollectionItem) then Continue;
+
+ MemberName := Prop.Name;
+ Attributes := Prop.GetAttributes;
+ // * Read Disable
+ if IsDisabled(Attributes) or IsDisabledWrite(Attributes) then
+ Continue;
+
+ // * Read Alias Name
+ GetAliasName(Attributes, MemberName);
+
+ Value := Prop.GetValue(Data);
+
+ // * Read Reval Attribute
+ RevalAttribute := GetREVAL(Attributes);
+ if (RevalAttribute <> Nil) and (RevalAttribute.CheckEQ(Value)) then
+ Value := TValue.FromVariant(RevalAttribute.Value);
+
+ ReadMember(MemberName, Prop.PropertyType.Handle, Value, IJSonData);
+ end;
+
+ for Field in aType.GetFields do
+ begin
+ if not (Field.Visibility in TSerializeParseOptions.Visibilities) then Continue;
+
+ MemberName := Field.Name;
+ Attributes := Field.GetAttributes;
+ // * Read Disable
+ if IsDisabled(Attributes) or IsDisabledWrite(Attributes) then
+ Continue;
+
+ // * Read Alias Name
+ GetAliasName(Field.GetAttributes, MemberName);
+
+ Value := Field.GetValue(Data);
+
+ // * Read Reval Attribute
+ RevalAttribute := GetREVAL(Field.GetAttributes);
+ if (RevalAttribute <> Nil) and (RevalAttribute.CheckEQ(Value)) then
+ Value := TValue.FromVariant(RevalAttribute.Value);
+
+ ReadMember(MemberName, Field.FieldType.Handle, Value, IJSonData);
+ end;
+end;
+
+class procedure TSerializeParse.ReadObject(AObject: TObject; IResult: ISuperObject);
+var
+ Ctx: TRttiContext;
+ Typ: TRttiType;
+begin
+ Ctx := TRttiContext.Create;
+ try
+ Typ := Ctx.GetType(AObject.ClassType);
+ if not Assigned(Typ) then Exit;
+ ReadMembers(AObject, Typ, IResult) ;
+ finally
+ Ctx.Free;
+ end;
+end;
+
+class procedure TSerializeParse.ReadRecord(Info: PTypeInfo; ARecord: Pointer; IResult: ISuperObject);
+var
+ Ctx: TRttiContext;
+ Typ: TRttiRecordType;
+begin
+ Ctx := TRttiContext.Create;
+ try
+ Typ := Ctx.GetType(Info).AsRecord;
+ if not Assigned(Typ) then Exit;
+ ReadMembers(ARecord, Typ, IResult) ;
+ finally
+ Ctx.Free;
+ end;
+end;
+
+class function TSerializeParse.ReadRecordEx(Rec: T): ISuperObject;
+var
+ IResult: ISuperObject;
+begin
+ try
+ IResult := TSuperObject.Create;
+ with TValue.From(Rec) do
+ ReadRecord(TypeInfo, GetReferenceToRawData, IResult);
+ finally
+ Result := IResult;
+ end;
+end;
+
+class function TSerializeParse.CheckObject(Data: Pointer;
+ Member: TRttiObject; MIdx: Typ; var Obj: TObject): Boolean;
+var
+ rtype: TRttiType;
+ rawData: Pointer;
+ Val, ArrVal: TValue;
+begin
+ Obj := Nil;
+ rawData := GetArrayRawData(Member);
+ rtype := GetMemberType(Member);
+ if rawData <> nil then
+ begin
+ Obj := GetValue(rawData, Member, MIdx).AsObject;
+ if (Obj = Nil) and (ObjectConstructorParamCount(rtype.AsInstance.MetaclassType) = 0 ) then
+ begin
+ Obj := ObjectConstructor(rtype.AsInstance.MetaclassType);
+ TValue.Make(@Obj, rtype.Handle , Val);
+ if Member.ClassType = TRttiDynamicArrayType then begin
+ TValue.Make(rawData, TRttiDynamicArrayType(Member).Handle, ArrVal);
+ rawData := ArrVal.GetReferenceToRawArrayElement(PInteger(@MIdx)^)
+
+ end else if Member.ClassType = TRttiArrayType then begin
+ TValue.Make(rawData, TRttiArrayType(Member).Handle, ArrVal);
+ rawData := ArrVal.GetReferenceToRawArrayElement(PInteger(@MIdx)^)
+
+ end;
+
+ SetValue(rawData, Member, MIdx, Val);
+ end;
+ end
+ else
+ begin
+ Obj := GetValue(Data, Member, '').AsObject;
+ if (Obj = Nil) and (ObjectConstructorParamCount(rtype.AsInstance.MetaclassType) = 0 ) then
+ begin
+ Obj := ObjectConstructor(rtype.AsInstance.MetaclassType);
+ TValue.Make(@Obj, rtype.Handle , Val);
+ SetValue(Data, Member, '', Val);
+ end;
+ end;
+ Result := Obj <> nil;
+end;
+
+class procedure TSerializeParse.ClearArrayRawData(Member: TRttiObject);
+begin
+ SetArrayRawData(Member, Nil);
+end;
+
+class constructor TSerializeParse.Create;
+begin
+ FGenericsCache := TObjectDictionary.Create([doOwnsValues]);
+end;
+
+class destructor TSerializeParse.Destroy;
+begin
+ FGenericsCache.Free;
+end;
+
+{$WARNINGS OFF}
+class function TSerializeParse.GetArrayRawData(Member: TRttiObject): Pointer;
+begin
+ if Member is TRttiProperty then
+ Result := TSuperProperty(Member).ArrayRawData
+
+ else if Member is TRttiField then
+ Result := TSuperField(Member).ArrayRawData
+
+ else if Member is TRttiDynamicArrayType then
+ Result := TSuperDynArr(Member).ArrayRawData
+
+ else if Member is TRttiArrayType then
+ Result := TSuperArr(Member).ArrayRawData;
+
+end;
+{$WARNINGS ON}
+
+class function TSerializeParse.GetAttribute(AttributeType: TAttributeClass; Attributes: TArray): TCustomAttribute;
+var
+ Attr: TCustomAttribute;
+begin
+ for Attr in Attributes do
+ if Attr is AttributeType then
+ Exit(Attr);
+ Result := Nil;
+end;
+
+class function TSerializeParse.GetGenericsCreateArgs(Cls: TRttiType): TArray;
+var
+ Info: TGenericsInfo;
+begin
+ SetLength(Result, 0);
+ if FGenericsCache.TryGetValue(Cls.AsInstance.MetaclassType, Info) then
+ Result := Info.CreateArgs
+ else
+ if Cls.AsInstance.MetaclassType.InheritsFrom(TStringStream) then
+ begin
+ SetLength(Result, 3);
+ Result[0] := TValue.From('');
+ Result[1] := TValue.From(TEncoding.UTF8);
+ Result[2] := TValue.From(True)
+ end;
+
+end;
+
+class function TSerializeParse.GetGenericType(Cls: TClass): TGenericsType;
+var
+ Temp: String;
+begin
+ Temp := Cls.ClassName;
+ if Copy(Temp, 1, 6) = 'TList<' then
+ Result := gtList
+ else if Copy(Temp, 1, 12) = 'TObjectList<' then
+ Result := gtObjectList
+ else
+ Result := gtNil
+end;
+
+{$WARNINGS OFF}
+class function TSerializeParse.GetMemberType(Member: TRttiObject; const GetArray: Boolean): TRttiType;
+begin
+ if Member is TRttiProperty then begin
+ Result := TRttiProperty(Member).PropertyType;
+ if GetArray and (TSuperProperty(Member).ArrayRawData <> Nil) then
+ if Result is TRttiArrayType then
+ Result := TRttiArrayType(Result).ElementType
+ else
+ Result := TRttiDynamicArrayType(Result).ElementType;
+
+ end else if Member is TRttiField then begin
+ Result := TRttiField(Member).FieldType;
+ if GetArray and (TSuperField(Member).ArrayRawData <> Nil) then
+ if Result is TRttiArrayType then
+ Result := TRttiArrayType(Result).ElementType
+ else
+ Result := TRttiDynamicArrayType(Result).ElementType;
+
+ end else if Member is TRttiDynamicArrayType then begin
+ Result := TRttiDynamicArrayType(Member).ElementType
+
+ end else if Member is TRttiArrayType then begin
+ Result := TRttiArrayType(Member).ElementType
+
+ end;
+end;
+{$WARNINGS ON}
+
+class function TSerializeParse.GetMemberTypeInfo(
+ Member: TRttiObject; const GetArray: Boolean): PTypeInfo;
+begin
+ Result := GetMemberType(Member, GetArray).Handle
+end;
+
+class function TSerializeParse.GetREVAL(const Attributues: TArray): REVAL;
+begin
+ Result := REVAL(GetAttribute(REVAL, Attributues));
+end;
+
+class function TSerializeParse.PropGetterType(Prop: TRttiProperty): TPropertyGetterType;
+var
+ Getter: Pointer;
+begin
+ if Prop is TRttiInstanceProperty then begin
+ Getter := TRttiInstanceProperty(Prop).PropInfo^.GetProc;
+ if (IntPtr(Getter) and PROPSLOT_MASK) <> PROPSLOT_FIELD then
+ Exit(pgtMethod);
+ end;
+ Result := pgtField;
+end;
+
+class function TSerializeParse.GetValue(Data: Pointer;
+ Member: TRttiObject; MIdx: Typ): TValue;
+begin
+ if (TypeInfo(Typ) = TypeInfo(Integer) ) and ( GetMemberTypeInfo(Member, False).Kind in [tkDynArray, tkArray] ) then
+ Result := GetValue