├── .gitattributes
├── .gitignore
├── README.md
├── samples
├── Sample 1 - Class
│ ├── SampleClass.dpr
│ └── SampleClass.dproj
├── Sample 2 - Record
│ ├── SampleRecord.dpr
│ └── SampleRecord.dproj
├── Sample 3 - Types
│ ├── SampleTypes.dpr
│ └── SampleTypes.dproj
└── Sample 4 - Simples
│ ├── SampleSimple.dpr
│ └── SampleSimple.dproj
└── src
├── DataStorage.Data.Utils.pas
├── DataStorage.Data.pas
├── DataStorage.DataBase.Utils.pas
├── DataStorage.DataBase.pas
├── DataStorage.Intf.pas
├── DataStorage.Item.Utils.pas
├── DataStorage.Item.pas
├── DataStorage.Table.Utils.pas
├── DataStorage.Table.pas
├── DataStorage.Value.pas
└── DataStorage.pas
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | modules/
2 | dist/
3 | static/
4 | **/Android/
5 | **/Android64/
6 | **/Win32/
7 | **/Win64/
8 | **/Linux64/
9 | **/__history/
10 | **/__recovery/
11 | src/*.~*
12 | *.res
13 | *.exe
14 | *.dll
15 | *.bpl
16 | *.bpi
17 | *.dcp
18 | *.so
19 | *.apk
20 | *.drc
21 | *.map
22 | *.dres
23 | *.rsm
24 | *.tds
25 | *.dcu
26 | *.lib
27 | *.a
28 | *.o
29 | *.ocx
30 | *.local
31 | *.identcache
32 | *.projdata
33 | *.tvsconfig
34 | *.dsk
35 | *.dcu
36 | *.exe
37 | *.so
38 | *.~*
39 | *.a
40 | *.stat
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | # DataStorage
18 |
19 | DataStorage foi projetado para ser uma biblioteca simples e com possibilidades de salvar quase todo o tipo de registro.
20 |
21 | Support: developer.dlio@gmail.com
22 |
23 | ## Instalação
24 |
25 | #### Para instalar em seu projeto usando [boss](https://github.com/HashLoad/boss):
26 | ```sh
27 | $ boss install github.com/dliocode/datastorage
28 | ```
29 |
30 | #### Instalação Manual
31 |
32 | Adicione as seguintes pastas ao seu projeto, em *Project > Options > Delphi Compiler > Search path*
33 |
34 | ```
35 | ../datastorage/src
36 | ```
37 |
38 | ## Como usar
39 |
40 | #### **Uses necessária**
41 |
42 | ```
43 | uses DataStorage;
44 | ```
45 |
46 | #### **Estrutura**
47 |
48 | * DataBase
49 | * Table
50 | * Item
51 |
52 | #### **Como adicionar as informações**
53 |
54 | ##### Modo: Simples
55 | ```
56 | TDataStorage.New
57 | .DataBase('configurations')
58 | .Table('users')
59 | .SetItem('id', '1')
60 | .SetItem('name', 'DLIO Code')
61 | .SetItem('login', 'developer.dlio@gmail.com')
62 | .SetItem('password', 'my_passowrd')
63 | ```
64 |
65 | ##### Modo: Simples - Type: String / Integer / Float / Boolean / Date / Time / DateTime / Array
66 | ```
67 | TDataStorage.New
68 | .Item('my_string').SetValue('value_string')
69 | .Item('my_integer').SetValue(1000)
70 | .Item('my_float').SetValue(18.50)
71 | .Item('my_boolean').SetValue(True)
72 | .Item('my_date').SetValue(Date)
73 | .Item('my_time').SetValue(Time)
74 | .Item('my_datetime').SetValue(Now)
75 |
76 | .Item('my_array_string').SetValue(TValue.From < TArray < string >> (['value_string 1', 'value_string 2', 'value_string 3']))
77 | .Item('my_array_integer').SetValue(TValue.From < TArray < Integer >> ([1000, 1001, 1002]))
78 | .Item('my_array_float').SetValue(TValue.From < TArray < Double >> ([18.50, 25.90, 48.92]))
79 | .Item('my_array_boolean').SetValue(TValue.From < TArray < Boolean >> ([False, True, False]))
80 | .Item('my_array_date').SetValue(TValue.From < TArray < TDateTime >> ([Date, Date + 5, Date + 20]))
81 | .Item('my_array_time').SetValue(TValue.From < TArray < TDateTime >> ([Time, Time + 5, Time + 20]))
82 | .Item('my_array_datetime').SetValue(TValue.From < TArray < TDateTime >> ([Now, Now + 5, Now + 20]));
83 | ```
84 |
85 | ##### Modo: Record
86 | ```
87 | type
88 | TUser = record
89 | Id: string;
90 | Name: string;
91 | Login: string;
92 | Password: string;
93 | end;
94 |
95 | var
96 | LUser: TUser;
97 | begin
98 | LUser.Id := '1';
99 | LUser.Name := 'DLIO CODE';
100 | LUser.Login := 'dlio.developer@gmail.com';
101 | LUser.Password := 'password';
102 |
103 | TDataStorage.New
104 | .DataBase('configurations')
105 | .Table('users')
106 | .SetItem('1', TValue.From(LUser));
107 |
108 | Readln;
109 | end.
110 |
111 | ```
112 |
113 | ##### Modo: Class
114 | ```
115 | type
116 | TUser = class
117 | private
118 | FId: string;
119 | FName: string;
120 | FLogin: string;
121 | FPassword: string;
122 | public
123 | property Id: string read FId write FId;
124 | property Name: string read FName write FName;
125 | property Login: string read FLogin write FLogin;
126 | property Password: string read FPassword write FPassword;
127 | end;
128 |
129 | var
130 | LUser: TUser;
131 | begin
132 | LUser := TUser.Create;
133 | try
134 | LUser.Id := '1';
135 | LUser.Name := 'DLIO CODE';
136 | LUser.Login := 'dlio.developer@gmail.com';
137 | LUser.Password := 'password';
138 |
139 | TDataStorage.New
140 | .DataBase('configurations')
141 | .Table('users')
142 | .SetItem('1', LUser);
143 |
144 | Readln;
145 | finally
146 | LUser.DisposeOf;
147 | end;
148 | end.
149 | ```
150 |
151 | #### **Como recuperar o dados adicionados**
152 |
153 | ##### Modo: Simples
154 | ```
155 | var
156 | LName: TValue;
157 | begin
158 | TDataStorage.New
159 | .DataBase('configurations')
160 | .Table('users')
161 | .GetItem('name', LName);
162 |
163 | // or
164 | //
165 | // LName :=
166 | // TDataStorage.New
167 | // .DataBase('configurations')
168 | // .Table('users')
169 | // .Item('name').GetValue;
170 |
171 | Writeln(LName.AsString);
172 |
173 | Readln;
174 |
175 | end.
176 | ```
177 |
178 | ##### Modo: Simples - Type: String / Integer / Float / Boolean / Date / Time / DateTime / Array
179 | ```
180 | with TDataStorage.New do
181 | begin
182 | writeln;
183 | writeln('>> Simple');
184 | writeln;
185 | Writeln( Item('my_string').GetValue.AsVariant );
186 | Writeln( Item('my_integer').GetValue.AsVariant );
187 | Writeln( Item('my_float').GetValue.AsVariant );
188 | Writeln( Item('my_boolean').GetValue.AsVariant );
189 | Writeln( DateToStr(Item('my_date').GetValue.AsVariant) );
190 | Writeln( TimeToStr(Item('my_time').GetValue.AsVariant) );
191 | Writeln( DateTimeToStr(Item('my_datetime').GetValue.AsVariant) );
192 |
193 | // Array
194 | writeln;
195 | writeln('>> Array');
196 | writeln;
197 | Writeln( Item('my_array_string').GetValue.AsType>[0]) ;
198 | Writeln( Item('my_array_integer').GetValue.AsType>[1] );
199 | Writeln( Item('my_array_float').GetValue.AsType>[2] );
200 | Writeln( Item('my_array_boolean').GetValue.AsType>[0] );
201 | Writeln( DateToStr(Item('my_array_date').GetValue.AsType>[1]) );
202 | Writeln( TimeToStr(Item('my_array_time').GetValue.AsType>[2]) );
203 | Writeln( DateTimeToStr(Item('my_array_datetime').GetValue.AsType>[0]) );
204 | end;
205 | ```
206 |
207 | ##### Modo: Record
208 | ```
209 | type
210 | TUser = record
211 | Id: string;
212 | Name: string;
213 | Login: string;
214 | Password: string;
215 | end;
216 |
217 | var
218 | LUser: TUser;
219 | begin
220 | LUser :=
221 | TDataStorage.New
222 | .DataBase('configurations')
223 | .Table('users').Item('1').GetValue.AsType;
224 |
225 | Writeln('Name: '+LUser.Name);
226 | Writeln('Login: '+LUser.Name);
227 |
228 | Readln;
229 | end.
230 |
231 | ```
232 |
233 | ##### Modo: Class
234 | ```
235 | type
236 | TUser = class
237 | private
238 | FId: string;
239 | FName: string;
240 | FLogin: string;
241 | FPassword: string;
242 | public
243 | property Id: string read FId write FId;
244 | property Name: string read FName write FName;
245 | property Login: string read FLogin write FLogin;
246 | property Password: string read FPassword write FPassword;
247 | end;
248 |
249 | var
250 | LUser: TUser;
251 | LUser2: TUser;
252 | begin
253 | LUser := TUser.Create;
254 | try
255 | LUser.Id := '1';
256 | LUser.Name := 'DLIO CODE';
257 | LUser.Login := 'dlio.developer@gmail.com';
258 | LUser.Password := 'password';
259 |
260 | TDataStorage.New
261 | .DataBase('configurations')
262 | .Table('users')
263 | .SetItem('1', LUser);
264 |
265 | LUser2 :=
266 | TDataStorage.New
267 | .DataBase('configurations')
268 | .Table('users')
269 | .Item('1').GetValue.AsType;
270 |
271 | Writeln('Name: '+LUser2.Name);
272 | Writeln('Login: '+LUser2.Name);
273 | finally
274 | LUser.DisposeOf;
275 | end;
276 | end.
277 | ```
278 |
279 | ### **DataBase**
280 |
281 | - **Como contar todos os DataBases**
282 | ``` TDataStorage.New.DataBase.Count; ```
283 |
284 | - **Como verificar se um DataBase existe**
285 | ``` TDataStorage.New.DataBase.IsExist('NAME'); ```
286 |
287 | - **Como remover um DataBase específico**
288 | ``` TDataStorage.New.DataBase.Remove('Name'); ```
289 |
290 | - **Como remover todos os DataBase**
291 | ``` TDataStorage.New.DataBase.Clear; ```
292 |
293 | ### **Table**
294 |
295 | - **Como contar todas as tabelas de um DataBase específico**
296 | ``` TDataStorage.New.DataBase('NAME').Table.Count; ```
297 |
298 | - **Como verificar se uma tabela existe de um DataBase específico**
299 | ``` TDataStorage.New.DataBase('NAME').Table.IsExist('TABLE NAME'); ```
300 |
301 | - **Como remove uma tabela de um DataBase específico**
302 | ``` TDataStorage.New.DataBase('NAME').Table.Remove('TABLE NAME'); ```
303 |
304 | - **Como remover todas as tabelas de um DataBase específico**
305 | ``` TDataStorage.New.DataBase('NAME').Table.Clear; ```
306 |
307 | ### **Item**
308 |
309 | - **Como contar todos os itens de uma tabela específica e um DataBase específico**
310 | ``` TDataStorage.New.DataBase('NAME').Table('TABLE NAME').Item.Count; ```
311 |
312 | - **Como verificar se um item existe de uma tabela específica e um DataBase específico**
313 | ``` TDataStorage.New.DataBase('NAME').Table('TABLE NAME').Item.IsExist('ITEM NAME'); ```
314 |
315 | - **Como remove um item de uma tabela específica e um DataBase específico**
316 | ``` TDataStorage.New.DataBase('NAME').Table('TABLE NAME').Item.Remove('ITEM NAME'); ```
317 |
318 | - **Como remover todas os itens de uma tabela específica e um DataBase específico**
319 | ``` TDataStorage.New.DataBase('NAME').Table('TABLE NAME').Item.Clear; ```
320 |
321 | ### **Data**
322 |
323 | - **Como salvar os dados**
324 | ``` TDataStorage.New.Data.SaveToFile('NAME_FILE.txt', True); // True = Salva Criptografado! ```
325 |
326 | - **Como carregar de um arquivo**
327 | ```TDataStorage.New.Data.LoadFromFile('NAME_FILE.txt', True); // True = Ler o dados Criptografados! ```
328 |
329 | - **Como obter os dados sem salvar**
330 | ``` TDataStorage.New.Data.ToJSON; ```
331 |
332 | - **Como setar os dados**
333 | ``` TDataStorage.New.Data.SetJSON(''); ```
334 |
--------------------------------------------------------------------------------
/samples/Sample 1 - Class/SampleClass.dpr:
--------------------------------------------------------------------------------
1 | program SampleClass;
2 |
3 | {$APPTYPE CONSOLE}
4 |
5 | {$R *.res}
6 |
7 |
8 | uses
9 | System.IOUtils,
10 | DataStorage;
11 |
12 | type
13 | TUser = class
14 | private
15 | FId: string;
16 | FName: string;
17 | FLogin: string;
18 | FPassword: string;
19 | public
20 | property Id: string read FId write FId;
21 | property Name: string read FName write FName;
22 | property Login: string read FLogin write FLogin;
23 | property Password: string read FPassword write FPassword;
24 | end;
25 |
26 | var
27 | LUser: TUser;
28 | LUser2: TUser;
29 | begin
30 | LUser := TUser.Create;
31 | try
32 | LUser.Id := '1';
33 | LUser.Name := 'DLIO CODE';
34 | LUser.Login := 'dlio.developer@gmail.com';
35 | LUser.Password := 'password';
36 |
37 | TDataStorage.New
38 | .DataBase('configurations')
39 | .Table('users')
40 | .SetItem('1', LUser);
41 |
42 | LUser2 :=
43 | TDataStorage.New
44 | .DataBase('configurations')
45 | .Table('users')
46 | .Item('1').GetValue.AsType;
47 |
48 | Writeln('Name: '+LUser2.Name);
49 | Writeln('Login: '+LUser2.Name);
50 |
51 | TDataStorage.New
52 | .Data.SaveToFile(TPath.GetFileNameWithoutExtension(ParamStr(0)) + '.txt', False);
53 | finally
54 | LUser.DisposeOf;
55 | end;
56 |
57 | Writeln;
58 | Writeln('Regisro salvo com sucesso!');
59 | Writeln;
60 |
61 | Readln;
62 |
63 | end.
64 |
--------------------------------------------------------------------------------
/samples/Sample 2 - Record/SampleRecord.dpr:
--------------------------------------------------------------------------------
1 | program SampleRecord;
2 |
3 | {$APPTYPE CONSOLE}
4 |
5 | {$R *.res}
6 |
7 |
8 | uses
9 | System.IOUtils,
10 | DataStorage;
11 |
12 | type
13 | TUser = record
14 | Id: string;
15 | Name: string;
16 | Login: string;
17 | Password: string;
18 | end;
19 |
20 | var
21 | LUser: TUser;
22 | begin
23 | LUser.Id := '1';
24 | LUser.Name := 'DLIO CODE';
25 | LUser.Login := 'dlio.developer@gmail.com';
26 | LUser.Password := 'password';
27 |
28 | TDataStorage.New
29 | .DataBase('configurations')
30 | .Table('users')
31 | .SetItem('1', TValue.From(LUser));
32 |
33 | LUser := Default(TUser); // Limpando a variavel;
34 |
35 | Writeln('Test nome: '+LUser.Name);
36 |
37 | LUser :=
38 | TDataStorage.New
39 | .DataBase('configurations')
40 | .Table('users').Item('1').GetValue.AsType;
41 |
42 | Writeln('Test nome: '+LUser.Name);
43 |
44 | TDataStorage.New
45 | .Data.SaveToFile(TPath.GetFileNameWithoutExtension(ParamStr(0)) + '.txt', False);
46 |
47 | Writeln;
48 | Writeln('Registro salvo com sucesso!');
49 | Writeln;
50 |
51 | Readln;
52 |
53 | end.
54 |
--------------------------------------------------------------------------------
/samples/Sample 2 - Record/SampleRecord.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {70BFFB57-0534-4F0D-BCD2-7E4F116F0FEF}
4 | 19.2
5 | None
6 | True
7 | Debug
8 | Win32
9 | 1
10 | Console
11 | SampleRecord.dpr
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Base
39 | true
40 |
41 |
42 | true
43 | Base
44 | true
45 |
46 |
47 | true
48 | Base
49 | true
50 |
51 |
52 | true
53 | Base
54 | true
55 |
56 |
57 | true
58 | Base
59 | true
60 |
61 |
62 | true
63 | Cfg_1
64 | true
65 | true
66 |
67 |
68 | true
69 | Base
70 | true
71 |
72 |
73 | .\$(Platform)\$(Config)
74 | .\$(Platform)\$(Config)
75 | false
76 | false
77 | false
78 | false
79 | false
80 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
81 | SampleRecord
82 |
83 |
84 | DBXSqliteDriver;RESTComponents;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
85 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
86 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
87 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
88 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
89 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
90 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
91 | $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
92 | $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
93 | $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
94 | $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
95 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png
96 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png
97 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png
98 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png
99 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png
100 | 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
101 |
102 |
103 | DBXSqliteDriver;RESTComponents;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
104 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
105 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
106 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
107 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
108 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
109 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
110 | $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
111 | $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
112 | $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
113 | $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
114 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png
115 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png
116 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png
117 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png
118 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png
119 | 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
120 |
121 |
122 | DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
123 |
124 |
125 | DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
126 |
127 |
128 | RESTComponents;emsclientfiredac;DataSnapFireDAC;FireDACADSDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;inetdb;emsedge;fmx;FireDACIBDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;soapserver;bindengine;CloudService;FireDACOracleDriver;FireDACMySQLDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndySystem;FireDACDb2Driver;FireDACInfxDriver;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;FireDACTDataDriver;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;rtl;emsserverresource;DbxClientDriver;CustomIPTransport;bindcomp;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;dbrtl;IndyProtocols;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
129 |
130 |
131 | DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
132 | true
133 |
134 |
135 | DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;bindcompvclsmp;emsclientfiredac;tethering;svnui;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;FireDACIBDriver;fmxdae;vcledge;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;bindcompvclwinx;dsnapcon;madExcept_;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;madBasic_;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;ibxbindings;DBXSybaseASADriver;madDisAsm_;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
136 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
137 | Debug
138 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
139 | 1033
140 | true
141 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
142 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
143 |
144 |
145 | DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;bindcompvclsmp;emsclientfiredac;tethering;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;FireDACIBDriver;fmxdae;vcledge;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;bindcompvclwinx;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;ibxbindings;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
146 | true
147 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
148 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
149 |
150 |
151 | DEBUG;$(DCC_Define)
152 | true
153 | false
154 | true
155 | true
156 | true
157 |
158 |
159 | false
160 | ..\..\src;$(DCC_UnitSearchPath)
161 | 1033
162 | (None)
163 |
164 |
165 | false
166 | RELEASE;$(DCC_Define)
167 | 0
168 | 0
169 |
170 |
171 |
172 | MainSource
173 |
174 |
175 | Cfg_2
176 | Base
177 |
178 |
179 | Base
180 |
181 |
182 | Cfg_1
183 | Base
184 |
185 |
186 |
187 | Delphi.Personality.12
188 | Application
189 |
190 |
191 |
192 | SampleRecord.dpr
193 |
194 |
195 | Embarcadero C++Builder Office 2000 Servers Package
196 | Embarcadero C++Builder Office XP Servers Package
197 | Microsoft Office 2000 Sample Automation Server Wrapper Components
198 | Microsoft Office XP Sample Automation Server Wrapper Components
199 |
200 |
201 |
202 |
203 |
204 | true
205 |
206 |
207 |
208 |
209 | true
210 |
211 |
212 |
213 |
214 | true
215 |
216 |
217 |
218 |
219 | SampleRecord.exe
220 | true
221 |
222 |
223 |
224 |
225 | 1
226 |
227 |
228 | Contents\MacOS
229 | 1
230 |
231 |
232 | 0
233 |
234 |
235 |
236 |
237 | classes
238 | 1
239 |
240 |
241 | classes
242 | 1
243 |
244 |
245 |
246 |
247 | res\xml
248 | 1
249 |
250 |
251 | res\xml
252 | 1
253 |
254 |
255 |
256 |
257 | library\lib\armeabi-v7a
258 | 1
259 |
260 |
261 |
262 |
263 | library\lib\armeabi
264 | 1
265 |
266 |
267 | library\lib\armeabi
268 | 1
269 |
270 |
271 |
272 |
273 | library\lib\armeabi-v7a
274 | 1
275 |
276 |
277 |
278 |
279 | library\lib\mips
280 | 1
281 |
282 |
283 | library\lib\mips
284 | 1
285 |
286 |
287 |
288 |
289 | library\lib\armeabi-v7a
290 | 1
291 |
292 |
293 | library\lib\arm64-v8a
294 | 1
295 |
296 |
297 |
298 |
299 | library\lib\armeabi-v7a
300 | 1
301 |
302 |
303 |
304 |
305 | res\drawable
306 | 1
307 |
308 |
309 | res\drawable
310 | 1
311 |
312 |
313 |
314 |
315 | res\values
316 | 1
317 |
318 |
319 | res\values
320 | 1
321 |
322 |
323 |
324 |
325 | res\values-v21
326 | 1
327 |
328 |
329 | res\values-v21
330 | 1
331 |
332 |
333 |
334 |
335 | res\values
336 | 1
337 |
338 |
339 | res\values
340 | 1
341 |
342 |
343 |
344 |
345 | res\drawable
346 | 1
347 |
348 |
349 | res\drawable
350 | 1
351 |
352 |
353 |
354 |
355 | res\drawable-xxhdpi
356 | 1
357 |
358 |
359 | res\drawable-xxhdpi
360 | 1
361 |
362 |
363 |
364 |
365 | res\drawable-xxxhdpi
366 | 1
367 |
368 |
369 | res\drawable-xxxhdpi
370 | 1
371 |
372 |
373 |
374 |
375 | res\drawable-ldpi
376 | 1
377 |
378 |
379 | res\drawable-ldpi
380 | 1
381 |
382 |
383 |
384 |
385 | res\drawable-mdpi
386 | 1
387 |
388 |
389 | res\drawable-mdpi
390 | 1
391 |
392 |
393 |
394 |
395 | res\drawable-hdpi
396 | 1
397 |
398 |
399 | res\drawable-hdpi
400 | 1
401 |
402 |
403 |
404 |
405 | res\drawable-xhdpi
406 | 1
407 |
408 |
409 | res\drawable-xhdpi
410 | 1
411 |
412 |
413 |
414 |
415 | res\drawable-mdpi
416 | 1
417 |
418 |
419 | res\drawable-mdpi
420 | 1
421 |
422 |
423 |
424 |
425 | res\drawable-hdpi
426 | 1
427 |
428 |
429 | res\drawable-hdpi
430 | 1
431 |
432 |
433 |
434 |
435 | res\drawable-xhdpi
436 | 1
437 |
438 |
439 | res\drawable-xhdpi
440 | 1
441 |
442 |
443 |
444 |
445 | res\drawable-xxhdpi
446 | 1
447 |
448 |
449 | res\drawable-xxhdpi
450 | 1
451 |
452 |
453 |
454 |
455 | res\drawable-xxxhdpi
456 | 1
457 |
458 |
459 | res\drawable-xxxhdpi
460 | 1
461 |
462 |
463 |
464 |
465 | res\drawable-small
466 | 1
467 |
468 |
469 | res\drawable-small
470 | 1
471 |
472 |
473 |
474 |
475 | res\drawable-normal
476 | 1
477 |
478 |
479 | res\drawable-normal
480 | 1
481 |
482 |
483 |
484 |
485 | res\drawable-large
486 | 1
487 |
488 |
489 | res\drawable-large
490 | 1
491 |
492 |
493 |
494 |
495 | res\drawable-xlarge
496 | 1
497 |
498 |
499 | res\drawable-xlarge
500 | 1
501 |
502 |
503 |
504 |
505 | res\values
506 | 1
507 |
508 |
509 | res\values
510 | 1
511 |
512 |
513 |
514 |
515 | 1
516 |
517 |
518 | Contents\MacOS
519 | 1
520 |
521 |
522 | 0
523 |
524 |
525 |
526 |
527 | Contents\MacOS
528 | 1
529 | .framework
530 |
531 |
532 | Contents\MacOS
533 | 1
534 | .framework
535 |
536 |
537 | 0
538 |
539 |
540 |
541 |
542 | 1
543 | .dylib
544 |
545 |
546 | 1
547 | .dylib
548 |
549 |
550 | 1
551 | .dylib
552 |
553 |
554 | Contents\MacOS
555 | 1
556 | .dylib
557 |
558 |
559 | Contents\MacOS
560 | 1
561 | .dylib
562 |
563 |
564 | 0
565 | .dll;.bpl
566 |
567 |
568 |
569 |
570 | 1
571 | .dylib
572 |
573 |
574 | 1
575 | .dylib
576 |
577 |
578 | 1
579 | .dylib
580 |
581 |
582 | Contents\MacOS
583 | 1
584 | .dylib
585 |
586 |
587 | Contents\MacOS
588 | 1
589 | .dylib
590 |
591 |
592 | 0
593 | .bpl
594 |
595 |
596 |
597 |
598 | 0
599 |
600 |
601 | 0
602 |
603 |
604 | 0
605 |
606 |
607 | 0
608 |
609 |
610 | 0
611 |
612 |
613 | Contents\Resources\StartUp\
614 | 0
615 |
616 |
617 | Contents\Resources\StartUp\
618 | 0
619 |
620 |
621 | 0
622 |
623 |
624 |
625 |
626 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
627 | 1
628 |
629 |
630 |
631 |
632 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
633 | 1
634 |
635 |
636 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
637 | 1
638 |
639 |
640 |
641 |
642 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
643 | 1
644 |
645 |
646 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
647 | 1
648 |
649 |
650 |
651 |
652 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
653 | 1
654 |
655 |
656 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
657 | 1
658 |
659 |
660 |
661 |
662 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
663 | 1
664 |
665 |
666 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
667 | 1
668 |
669 |
670 |
671 |
672 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
673 | 1
674 |
675 |
676 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
677 | 1
678 |
679 |
680 |
681 |
682 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
683 | 1
684 |
685 |
686 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
687 | 1
688 |
689 |
690 |
691 |
692 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
693 | 1
694 |
695 |
696 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
697 | 1
698 |
699 |
700 |
701 |
702 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
703 | 1
704 |
705 |
706 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
707 | 1
708 |
709 |
710 |
711 |
712 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
713 | 1
714 |
715 |
716 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
717 | 1
718 |
719 |
720 |
721 |
722 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
723 | 1
724 |
725 |
726 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
727 | 1
728 |
729 |
730 |
731 |
732 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
733 | 1
734 |
735 |
736 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
737 | 1
738 |
739 |
740 |
741 |
742 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
743 | 1
744 |
745 |
746 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
747 | 1
748 |
749 |
750 |
751 |
752 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
753 | 1
754 |
755 |
756 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
757 | 1
758 |
759 |
760 |
761 |
762 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
763 | 1
764 |
765 |
766 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
767 | 1
768 |
769 |
770 |
771 |
772 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
773 | 1
774 |
775 |
776 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
777 | 1
778 |
779 |
780 |
781 |
782 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
783 | 1
784 |
785 |
786 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
787 | 1
788 |
789 |
790 |
791 |
792 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
793 | 1
794 |
795 |
796 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
797 | 1
798 |
799 |
800 |
801 |
802 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
803 | 1
804 |
805 |
806 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
807 | 1
808 |
809 |
810 |
811 |
812 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
813 | 1
814 |
815 |
816 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
817 | 1
818 |
819 |
820 |
821 |
822 | 1
823 |
824 |
825 | 1
826 |
827 |
828 |
829 |
830 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
831 | 1
832 |
833 |
834 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
835 | 1
836 |
837 |
838 |
839 |
840 | ..\
841 | 1
842 |
843 |
844 | ..\
845 | 1
846 |
847 |
848 |
849 |
850 | 1
851 |
852 |
853 | 1
854 |
855 |
856 | 1
857 |
858 |
859 |
860 |
861 | ..\$(PROJECTNAME).launchscreen
862 | 64
863 |
864 |
865 | ..\$(PROJECTNAME).launchscreen
866 | 64
867 |
868 |
869 |
870 |
871 | 1
872 |
873 |
874 | 1
875 |
876 |
877 | 1
878 |
879 |
880 |
881 |
882 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
883 | 1
884 |
885 |
886 |
887 |
888 | ..\
889 | 1
890 |
891 |
892 | ..\
893 | 1
894 |
895 |
896 |
897 |
898 | Contents
899 | 1
900 |
901 |
902 | Contents
903 | 1
904 |
905 |
906 |
907 |
908 | Contents\Resources
909 | 1
910 |
911 |
912 | Contents\Resources
913 | 1
914 |
915 |
916 |
917 |
918 | library\lib\armeabi-v7a
919 | 1
920 |
921 |
922 | library\lib\arm64-v8a
923 | 1
924 |
925 |
926 | 1
927 |
928 |
929 | 1
930 |
931 |
932 | 1
933 |
934 |
935 | 1
936 |
937 |
938 | Contents\MacOS
939 | 1
940 |
941 |
942 | Contents\MacOS
943 | 1
944 |
945 |
946 | 0
947 |
948 |
949 |
950 |
951 | library\lib\armeabi-v7a
952 | 1
953 |
954 |
955 |
956 |
957 | 1
958 |
959 |
960 | 1
961 |
962 |
963 |
964 |
965 | Assets
966 | 1
967 |
968 |
969 | Assets
970 | 1
971 |
972 |
973 |
974 |
975 | Assets
976 | 1
977 |
978 |
979 | Assets
980 | 1
981 |
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 | False
996 | False
997 | False
998 | False
999 | False
1000 | False
1001 | True
1002 | False
1003 |
1004 |
1005 | 12
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
--------------------------------------------------------------------------------
/samples/Sample 3 - Types/SampleTypes.dpr:
--------------------------------------------------------------------------------
1 | program SampleTypes;
2 |
3 | {$APPTYPE CONSOLE}
4 |
5 | {$R *.res}
6 |
7 |
8 | uses
9 | System.IOUtils, System.SysUtils,
10 | DataStorage;
11 |
12 | begin
13 | TDataStorage.New
14 | .Item('my_string').SetValue('value_string')
15 | .Item('my_integer').SetValue(1000)
16 | .Item('my_float').SetValue(18.50)
17 | .Item('my_boolean').SetValue(True)
18 | .Item('my_date').SetValue(Date)
19 | .Item('my_time').SetValue(Time)
20 | .Item('my_datetime').SetValue(Now)
21 |
22 | .Item('my_array_string').SetValue(TValue.From < TArray < string >> (['value_string 1', 'value_string 2', 'value_string 3']))
23 | .Item('my_array_integer').SetValue(TValue.From < TArray < Integer >> ([1000, 1001, 1002]))
24 | .Item('my_array_float').SetValue(TValue.From < TArray < Double >> ([18.50, 25.90, 48.92]))
25 | .Item('my_array_boolean').SetValue(TValue.From < TArray < Boolean >> ([False, True, False]))
26 | .Item('my_array_date').SetValue(TValue.From < TArray < TDateTime >> ([Date, Date + 5, Date + 20]))
27 | .Item('my_array_time').SetValue(TValue.From < TArray < TDateTime >> ([Time, Time + 5, Time + 20]))
28 | .Item('my_array_datetime').SetValue(TValue.From < TArray < TDateTime >> ([Now, Now + 5, Now + 20]));
29 |
30 |
31 | with TDataStorage.New do
32 | begin
33 | writeln;
34 | writeln('>> Simple');
35 | writeln;
36 | Writeln(Item('my_string').GetValue.AsVariant);
37 | Writeln(Item('my_integer').GetValue.AsVariant);
38 | Writeln(Item('my_float').GetValue.AsVariant);
39 | Writeln(Item('my_boolean').GetValue.AsVariant);
40 | Writeln(DateToStr(Item('my_date').GetValue.AsVariant));
41 | Writeln(TimeToStr(Item('my_time').GetValue.AsVariant));
42 | Writeln(DateTimeToStr(Item('my_datetime').GetValue.AsVariant));
43 |
44 | // Array
45 | writeln;
46 | writeln('>> Array');
47 | writeln;
48 | Writeln(Item('my_array_string').GetValue.AsType>[1]);
49 | Writeln(Item('my_array_integer').GetValue.AsType>[1]);
50 | Writeln(Item('my_array_float').GetValue.AsType>[1]);
51 | Writeln(Item('my_array_boolean').GetValue.AsType>[1]);
52 | Writeln(DateToStr(Item('my_array_date').GetValue.AsType>[1]));
53 | Writeln(TimeToStr(Item('my_array_time').GetValue.AsType>[1]));
54 | Writeln(DateTimeToStr(Item('my_array_datetime').GetValue.AsType>[1]));
55 | end;
56 |
57 | TDataStorage.New
58 | .Data.SaveToFile(TPath.GetFileNameWithoutExtension(ParamStr(0)) + '.txt', False);
59 |
60 | Writeln;
61 | Writeln('Registro salvo com sucesso!');
62 | Writeln;
63 |
64 | Readln;
65 |
66 | end.
67 |
--------------------------------------------------------------------------------
/samples/Sample 3 - Types/SampleTypes.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {599DC23A-B4A1-484C-A444-1DD9D87810C1}
4 | 19.2
5 | None
6 | True
7 | Debug
8 | Win32
9 | 1
10 | Console
11 | SampleTypes.dpr
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Base
39 | true
40 |
41 |
42 | true
43 | Base
44 | true
45 |
46 |
47 | true
48 | Base
49 | true
50 |
51 |
52 | true
53 | Base
54 | true
55 |
56 |
57 | true
58 | Base
59 | true
60 |
61 |
62 | true
63 | Cfg_1
64 | true
65 | true
66 |
67 |
68 | true
69 | Base
70 | true
71 |
72 |
73 | .\$(Platform)\$(Config)
74 | .\$(Platform)\$(Config)
75 | false
76 | false
77 | false
78 | false
79 | false
80 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
81 | SampleTypes
82 |
83 |
84 | DBXSqliteDriver;RESTComponents;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
85 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
86 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
87 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
88 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
89 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
90 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
91 | $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
92 | $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
93 | $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
94 | $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
95 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png
96 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png
97 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png
98 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png
99 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png
100 | 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
101 |
102 |
103 | DBXSqliteDriver;RESTComponents;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
104 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
105 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
106 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
107 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
108 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
109 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png
110 | $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
111 | $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
112 | $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
113 | $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
114 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png
115 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png
116 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png
117 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png
118 | $(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png
119 | 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
120 |
121 |
122 | DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
123 |
124 |
125 | DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;FmxTeeUI;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)
126 |
127 |
128 | RESTComponents;emsclientfiredac;DataSnapFireDAC;FireDACADSDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;inetdb;emsedge;fmx;FireDACIBDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;soapserver;bindengine;CloudService;FireDACOracleDriver;FireDACMySQLDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndySystem;FireDACDb2Driver;FireDACInfxDriver;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;FireDACTDataDriver;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;rtl;emsserverresource;DbxClientDriver;CustomIPTransport;bindcomp;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;dbrtl;IndyProtocols;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
129 |
130 |
131 | DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;FireDACDSDriver;rtl;DbxClientDriver;ibxbindings;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
132 | true
133 |
134 |
135 | DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;bindcompvclsmp;emsclientfiredac;tethering;svnui;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;FireDACIBDriver;fmxdae;vcledge;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;bindcompvclwinx;dsnapcon;madExcept_;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;madBasic_;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;ibxbindings;DBXSybaseASADriver;madDisAsm_;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
136 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
137 | Debug
138 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
139 | 1033
140 | true
141 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
142 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
143 |
144 |
145 | DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;bindcompvclsmp;emsclientfiredac;tethering;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;FireDACIBDriver;fmxdae;vcledge;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;bindcompvclwinx;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;ibxbindings;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
146 | true
147 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
148 | $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
149 |
150 |
151 | DEBUG;$(DCC_Define)
152 | true
153 | false
154 | true
155 | true
156 | true
157 |
158 |
159 | false
160 | ..\..\src;$(DCC_UnitSearchPath)
161 | 1033
162 | (None)
163 |
164 |
165 | false
166 | RELEASE;$(DCC_Define)
167 | 0
168 | 0
169 |
170 |
171 |
172 | MainSource
173 |
174 |
175 | Cfg_2
176 | Base
177 |
178 |
179 | Base
180 |
181 |
182 | Cfg_1
183 | Base
184 |
185 |
186 |
187 | Delphi.Personality.12
188 | Application
189 |
190 |
191 |
192 | SampleTypes.dpr
193 |
194 |
195 | Embarcadero C++Builder Office 2000 Servers Package
196 | Embarcadero C++Builder Office XP Servers Package
197 | Microsoft Office 2000 Sample Automation Server Wrapper Components
198 | Microsoft Office XP Sample Automation Server Wrapper Components
199 |
200 |
201 |
202 |
203 |
204 | true
205 |
206 |
207 |
208 |
209 | true
210 |
211 |
212 |
213 |
214 | true
215 |
216 |
217 |
218 |
219 | SampleTypes.exe
220 | true
221 |
222 |
223 |
224 |
225 | 1
226 |
227 |
228 | Contents\MacOS
229 | 1
230 |
231 |
232 | 0
233 |
234 |
235 |
236 |
237 | classes
238 | 1
239 |
240 |
241 | classes
242 | 1
243 |
244 |
245 |
246 |
247 | res\xml
248 | 1
249 |
250 |
251 | res\xml
252 | 1
253 |
254 |
255 |
256 |
257 | library\lib\armeabi-v7a
258 | 1
259 |
260 |
261 |
262 |
263 | library\lib\armeabi
264 | 1
265 |
266 |
267 | library\lib\armeabi
268 | 1
269 |
270 |
271 |
272 |
273 | library\lib\armeabi-v7a
274 | 1
275 |
276 |
277 |
278 |
279 | library\lib\mips
280 | 1
281 |
282 |
283 | library\lib\mips
284 | 1
285 |
286 |
287 |
288 |
289 | library\lib\armeabi-v7a
290 | 1
291 |
292 |
293 | library\lib\arm64-v8a
294 | 1
295 |
296 |
297 |
298 |
299 | library\lib\armeabi-v7a
300 | 1
301 |
302 |
303 |
304 |
305 | res\drawable
306 | 1
307 |
308 |
309 | res\drawable
310 | 1
311 |
312 |
313 |
314 |
315 | res\values
316 | 1
317 |
318 |
319 | res\values
320 | 1
321 |
322 |
323 |
324 |
325 | res\values-v21
326 | 1
327 |
328 |
329 | res\values-v21
330 | 1
331 |
332 |
333 |
334 |
335 | res\values
336 | 1
337 |
338 |
339 | res\values
340 | 1
341 |
342 |
343 |
344 |
345 | res\drawable
346 | 1
347 |
348 |
349 | res\drawable
350 | 1
351 |
352 |
353 |
354 |
355 | res\drawable-xxhdpi
356 | 1
357 |
358 |
359 | res\drawable-xxhdpi
360 | 1
361 |
362 |
363 |
364 |
365 | res\drawable-xxxhdpi
366 | 1
367 |
368 |
369 | res\drawable-xxxhdpi
370 | 1
371 |
372 |
373 |
374 |
375 | res\drawable-ldpi
376 | 1
377 |
378 |
379 | res\drawable-ldpi
380 | 1
381 |
382 |
383 |
384 |
385 | res\drawable-mdpi
386 | 1
387 |
388 |
389 | res\drawable-mdpi
390 | 1
391 |
392 |
393 |
394 |
395 | res\drawable-hdpi
396 | 1
397 |
398 |
399 | res\drawable-hdpi
400 | 1
401 |
402 |
403 |
404 |
405 | res\drawable-xhdpi
406 | 1
407 |
408 |
409 | res\drawable-xhdpi
410 | 1
411 |
412 |
413 |
414 |
415 | res\drawable-mdpi
416 | 1
417 |
418 |
419 | res\drawable-mdpi
420 | 1
421 |
422 |
423 |
424 |
425 | res\drawable-hdpi
426 | 1
427 |
428 |
429 | res\drawable-hdpi
430 | 1
431 |
432 |
433 |
434 |
435 | res\drawable-xhdpi
436 | 1
437 |
438 |
439 | res\drawable-xhdpi
440 | 1
441 |
442 |
443 |
444 |
445 | res\drawable-xxhdpi
446 | 1
447 |
448 |
449 | res\drawable-xxhdpi
450 | 1
451 |
452 |
453 |
454 |
455 | res\drawable-xxxhdpi
456 | 1
457 |
458 |
459 | res\drawable-xxxhdpi
460 | 1
461 |
462 |
463 |
464 |
465 | res\drawable-small
466 | 1
467 |
468 |
469 | res\drawable-small
470 | 1
471 |
472 |
473 |
474 |
475 | res\drawable-normal
476 | 1
477 |
478 |
479 | res\drawable-normal
480 | 1
481 |
482 |
483 |
484 |
485 | res\drawable-large
486 | 1
487 |
488 |
489 | res\drawable-large
490 | 1
491 |
492 |
493 |
494 |
495 | res\drawable-xlarge
496 | 1
497 |
498 |
499 | res\drawable-xlarge
500 | 1
501 |
502 |
503 |
504 |
505 | res\values
506 | 1
507 |
508 |
509 | res\values
510 | 1
511 |
512 |
513 |
514 |
515 | 1
516 |
517 |
518 | Contents\MacOS
519 | 1
520 |
521 |
522 | 0
523 |
524 |
525 |
526 |
527 | Contents\MacOS
528 | 1
529 | .framework
530 |
531 |
532 | Contents\MacOS
533 | 1
534 | .framework
535 |
536 |
537 | 0
538 |
539 |
540 |
541 |
542 | 1
543 | .dylib
544 |
545 |
546 | 1
547 | .dylib
548 |
549 |
550 | 1
551 | .dylib
552 |
553 |
554 | Contents\MacOS
555 | 1
556 | .dylib
557 |
558 |
559 | Contents\MacOS
560 | 1
561 | .dylib
562 |
563 |
564 | 0
565 | .dll;.bpl
566 |
567 |
568 |
569 |
570 | 1
571 | .dylib
572 |
573 |
574 | 1
575 | .dylib
576 |
577 |
578 | 1
579 | .dylib
580 |
581 |
582 | Contents\MacOS
583 | 1
584 | .dylib
585 |
586 |
587 | Contents\MacOS
588 | 1
589 | .dylib
590 |
591 |
592 | 0
593 | .bpl
594 |
595 |
596 |
597 |
598 | 0
599 |
600 |
601 | 0
602 |
603 |
604 | 0
605 |
606 |
607 | 0
608 |
609 |
610 | 0
611 |
612 |
613 | Contents\Resources\StartUp\
614 | 0
615 |
616 |
617 | Contents\Resources\StartUp\
618 | 0
619 |
620 |
621 | 0
622 |
623 |
624 |
625 |
626 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
627 | 1
628 |
629 |
630 |
631 |
632 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
633 | 1
634 |
635 |
636 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
637 | 1
638 |
639 |
640 |
641 |
642 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
643 | 1
644 |
645 |
646 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
647 | 1
648 |
649 |
650 |
651 |
652 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
653 | 1
654 |
655 |
656 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
657 | 1
658 |
659 |
660 |
661 |
662 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
663 | 1
664 |
665 |
666 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
667 | 1
668 |
669 |
670 |
671 |
672 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
673 | 1
674 |
675 |
676 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
677 | 1
678 |
679 |
680 |
681 |
682 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
683 | 1
684 |
685 |
686 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
687 | 1
688 |
689 |
690 |
691 |
692 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
693 | 1
694 |
695 |
696 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
697 | 1
698 |
699 |
700 |
701 |
702 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
703 | 1
704 |
705 |
706 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
707 | 1
708 |
709 |
710 |
711 |
712 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
713 | 1
714 |
715 |
716 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
717 | 1
718 |
719 |
720 |
721 |
722 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
723 | 1
724 |
725 |
726 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
727 | 1
728 |
729 |
730 |
731 |
732 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
733 | 1
734 |
735 |
736 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
737 | 1
738 |
739 |
740 |
741 |
742 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
743 | 1
744 |
745 |
746 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
747 | 1
748 |
749 |
750 |
751 |
752 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
753 | 1
754 |
755 |
756 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
757 | 1
758 |
759 |
760 |
761 |
762 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
763 | 1
764 |
765 |
766 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
767 | 1
768 |
769 |
770 |
771 |
772 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
773 | 1
774 |
775 |
776 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
777 | 1
778 |
779 |
780 |
781 |
782 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
783 | 1
784 |
785 |
786 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
787 | 1
788 |
789 |
790 |
791 |
792 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
793 | 1
794 |
795 |
796 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
797 | 1
798 |
799 |
800 |
801 |
802 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
803 | 1
804 |
805 |
806 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
807 | 1
808 |
809 |
810 |
811 |
812 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
813 | 1
814 |
815 |
816 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
817 | 1
818 |
819 |
820 |
821 |
822 | 1
823 |
824 |
825 | 1
826 |
827 |
828 |
829 |
830 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
831 | 1
832 |
833 |
834 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
835 | 1
836 |
837 |
838 |
839 |
840 | ..\
841 | 1
842 |
843 |
844 | ..\
845 | 1
846 |
847 |
848 |
849 |
850 | 1
851 |
852 |
853 | 1
854 |
855 |
856 | 1
857 |
858 |
859 |
860 |
861 | ..\$(PROJECTNAME).launchscreen
862 | 64
863 |
864 |
865 | ..\$(PROJECTNAME).launchscreen
866 | 64
867 |
868 |
869 |
870 |
871 | 1
872 |
873 |
874 | 1
875 |
876 |
877 | 1
878 |
879 |
880 |
881 |
882 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
883 | 1
884 |
885 |
886 |
887 |
888 | ..\
889 | 1
890 |
891 |
892 | ..\
893 | 1
894 |
895 |
896 |
897 |
898 | Contents
899 | 1
900 |
901 |
902 | Contents
903 | 1
904 |
905 |
906 |
907 |
908 | Contents\Resources
909 | 1
910 |
911 |
912 | Contents\Resources
913 | 1
914 |
915 |
916 |
917 |
918 | library\lib\armeabi-v7a
919 | 1
920 |
921 |
922 | library\lib\arm64-v8a
923 | 1
924 |
925 |
926 | 1
927 |
928 |
929 | 1
930 |
931 |
932 | 1
933 |
934 |
935 | 1
936 |
937 |
938 | Contents\MacOS
939 | 1
940 |
941 |
942 | Contents\MacOS
943 | 1
944 |
945 |
946 | 0
947 |
948 |
949 |
950 |
951 | library\lib\armeabi-v7a
952 | 1
953 |
954 |
955 |
956 |
957 | 1
958 |
959 |
960 | 1
961 |
962 |
963 |
964 |
965 | Assets
966 | 1
967 |
968 |
969 | Assets
970 | 1
971 |
972 |
973 |
974 |
975 | Assets
976 | 1
977 |
978 |
979 | Assets
980 | 1
981 |
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 | False
996 | False
997 | False
998 | False
999 | False
1000 | False
1001 | True
1002 | False
1003 |
1004 |
1005 | 12
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
--------------------------------------------------------------------------------
/samples/Sample 4 - Simples/SampleSimple.dpr:
--------------------------------------------------------------------------------
1 | program SampleSimple;
2 |
3 | {$APPTYPE CONSOLE}
4 |
5 | {$R *.res}
6 |
7 |
8 | uses
9 | System.IOUtils, System.SysUtils,
10 | DataStorage;
11 |
12 | var
13 | LName: TValue;
14 |
15 | begin
16 | TDataStorage.New
17 | .DataBase('configurations')
18 | .Table('users')
19 | .SetItem('id', '1')
20 | .SetItem('name', 'DLIO Code')
21 | .SetItem('login', 'developer.dlio@gmail.com')
22 | .SetItem('password', 'my_passowrd');
23 |
24 | TDataStorage.New
25 | .DataBase('configurations')
26 | .Table('users')
27 | .GetItem('name', LName);
28 |
29 | // or
30 | //
31 | // LName :=
32 | // TDataStorage.New
33 | // .DataBase('configurations')
34 | // .Table('users')
35 | // .Item('name').GetValue.AsString;
36 |
37 | Writeln(LName.AsString);
38 |
39 | TDataStorage.New
40 | .Data.SaveToFile(TPath.GetFileNameWithoutExtension(ParamStr(0)) + '.txt', False);
41 |
42 | Writeln;
43 | Writeln('Registro salvo com sucesso!');
44 | Writeln;
45 |
46 | Readln;
47 |
48 | end.
49 |
--------------------------------------------------------------------------------
/src/DataStorage.Data.Utils.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.Data.Utils;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf,
14 | System.RTTI, System.StrUtils, System.Json, System.SysUtils, System.TypInfo, System.Generics.Collections, System.DateUtils, System.ZLib, System.NetEncoding, System.Classes;
15 |
16 | type
17 | EDataStorageException = class(Exception)
18 | end;
19 |
20 | TDataStorageDataUtils = class
21 | private
22 | function GetFormatSettings: TFormatSettings;
23 | function JsonToObject(const AClassName: string; AJSON: TJSONObject): TValue;
24 | function JsonToEnum(const AKeyEnum: string; const AValueEnum: string): TValue;
25 | function JsonToRecord(const AKeyRecord: string; const AJSON: TJSONObject): TValue;
26 | function JsonToArray(const AJSON: TJSONArray; const ARttiType: TRttiType): TValue;
27 | function JSONValueToTValue(const AJSON: TJSONValue; const ARttiType: TRttiType = nil): TValue;
28 | public
29 | procedure TValueToJSONObject(const AName: string; const AValue: TValue; out AJO: TJSONObject);
30 | function TJSONObjectToDataBase(const ADataBase: IDataStorageDataBase; const AJO: TJSONObject): IDataStorageDataBase;
31 | function ZLibCompress(const AText: string): string;
32 | function ZLibDecompress(const AText: string): string;
33 | end;
34 |
35 | implementation
36 |
37 | type
38 | TDataStorageRTTI = class
39 | private
40 | public
41 | class function FindAnyClassArray(const AName: string): TRttiType;
42 | class function FindAnyClass(const AName: string): TRttiType; overload;
43 | class function FindAnyClass(const AName: string; const ATypeKind: TTypeKind): TRttiType; overload;
44 | end;
45 |
46 | { TDataStorageDataUtils }
47 |
48 | function TDataStorageDataUtils.TJSONObjectToDataBase(const ADataBase: IDataStorageDataBase; const AJO: TJSONObject): IDataStorageDataBase;
49 | var
50 | I: Integer;
51 | LDataBase: string;
52 | J: Integer;
53 | LTable: string;
54 | K: Integer;
55 | LPair: TJsonPair;
56 | LKey: string;
57 | LJOValue: TJSONValue;
58 | LValue: TValue;
59 | begin
60 | Result := ADataBase;
61 | Result.DataBase.Clear;
62 |
63 | for I := 0 to Pred(AJO.Count) do
64 | begin
65 | LDataBase := AJO.Pairs[I].JsonString.Value;
66 |
67 | for J := 0 to Pred((AJO.Pairs[I].JsonValue as TJSONObject).Count) do
68 | begin
69 | LTable := (AJO.Pairs[I].JsonValue as TJSONObject).Pairs[J].JsonString.Value;
70 |
71 | for K := 0 to Pred(((AJO.Pairs[I].JsonValue as TJSONObject).Pairs[J].JsonValue as TJSONObject).Count) do
72 | begin
73 | LPair := ((AJO.Pairs[I].JsonValue as TJSONObject).Pairs[J].JsonValue as TJSONObject).Pairs[K];
74 |
75 | LKey := LPair.JsonString.Value;
76 | LJOValue := LPair.JsonValue;
77 | LValue := JSONValueToTValue(LJOValue);
78 |
79 | Result.DataBase(LDataBase).Table(LTable).Item(LKey).SetValue(LValue);
80 | end;
81 | end;
82 | end;
83 | end;
84 |
85 | procedure TDataStorageDataUtils.TValueToJSONObject(const AName: string; const AValue: TValue; out AJO: TJSONObject);
86 | type
87 | PPByte = ^PByte;
88 |
89 | function GetValue(Addr: Pointer; Typ: TRttiType): TValue;
90 | begin
91 | TValue.Make(Addr, Typ.Handle, Result);
92 | end;
93 |
94 | var
95 | LJO: TJSONObject;
96 | LValue: string;
97 | LClass: TRttiInstanceType;
98 | LRecord: TRttiRecordType;
99 | LJOValue: TJSONObject;
100 | LField: TRttiField;
101 | LJA: TJSONArray;
102 | I: Integer;
103 | LValueArray: TValue;
104 | LJOArray: TJSONObject;
105 | begin
106 | if not Assigned(AJO) then
107 | Exit;
108 |
109 | LJO := AJO;
110 |
111 | case AValue.Kind of
112 | tkInteger, tkInt64:
113 | LJO.AddPair(AName, TJSONNumber.Create(AValue.AsExtended));
114 |
115 | tkFloat:
116 | begin
117 | case IndexStr(string(AValue.TypeInfo.Name), ['TDateTime', 'TDate', 'TTime', 'TTimeStamp']) of
118 | 0: LJO.AddPair(TJsonPair.Create(AName, DateToISO8601(AValue.AsExtended, False)));
119 | 1: LJO.AddPair(TJsonPair.Create(AName, DateToStr(AValue.AsExtended, GetFormatSettings)));
120 | 2: LJO.AddPair(TJsonPair.Create(AName, TimeToStr(AValue.AsExtended, GetFormatSettings)));
121 | 3: LJO.AddPair(TJsonPair.Create(AName, DateToISO8601(AValue.AsExtended, False)));
122 | else
123 | LJO.AddPair(AName, TJSONNumber.Create(AValue.AsExtended));
124 | end;
125 | end;
126 |
127 | tkString, tkUString, tkLString, tkWString, tkWChar, tkChar, tkVariant:
128 | LJO.AddPair(AName, AValue.AsString);
129 |
130 | tkEnumeration:
131 | begin
132 | if AValue.TypeInfo = TypeInfo(Boolean) then
133 | begin
134 | LJO.AddPair(AName, TJSONBool.Create(AValue.AsBoolean));
135 | end
136 | else
137 | begin
138 | LValue := GetEnumName(AValue.TypeInfo, AValue.AsVariant);
139 |
140 | LJO
141 | .AddPair(AName, TJSONObject.Create).GetValue(AName)
142 | .AddPair('ds_data_enumerator', TJSONObject.Create).GetValue('ds_data_enumerator')
143 | .AddPair(string(AValue.TypeInfo.Name), LValue);
144 | end;
145 | end;
146 |
147 | tkClass:
148 | begin
149 | LClass := TRttiContext.Create.GetType(AValue.TypeInfo).AsInstance;
150 |
151 | LJOValue := TJSONObject.Create;
152 |
153 | for LField in LClass.GetFields do
154 | TValueToJSONObject(LField.Name, GetValue(PPByte(AValue.GetReferenceToRawData)^ + LField.Offset, LField.FieldType), LJOValue);
155 |
156 | LJO
157 | .AddPair(AName, TJSONObject.Create).GetValue(AName)
158 | .AddPair('ds_data_object', TJSONObject.Create).GetValue('ds_data_object')
159 | .AddPair(string(AValue.TypeInfo.Name), LJOValue);
160 | end;
161 |
162 | tkRecord:
163 | begin
164 | LRecord := TRttiContext.Create.GetType(AValue.TypeInfo).AsRecord;
165 |
166 | LJOValue := TJSONObject.Create;
167 |
168 | for LField in LRecord.GetFields do
169 | TValueToJSONObject(LField.Name, LField.GetValue(AValue.GetReferenceToRawData), LJOValue);
170 |
171 | LJO
172 | .AddPair(AName, TJSONObject.Create).GetValue(AName)
173 | .AddPair('ds_data_record', TJSONObject.Create).GetValue('ds_data_record')
174 | .AddPair(string(AValue.TypeInfo.Name), LJOValue);
175 | end;
176 |
177 | tkArray, tkDynArray:
178 | begin
179 | LJA := LJO.AddPair(AName, TJSONArray.Create).GetValue(AName);
180 |
181 | for I := 0 to Pred(AValue.GetArrayLength) do
182 | begin
183 | LValueArray := AValue.GetArrayElement(I);
184 |
185 | LJOArray := TJSONObject.Create;
186 | TValueToJSONObject(string(LValueArray.TypeInfo.Name), LValueArray, LJOArray);
187 |
188 | LJA.Add(LJOArray);
189 | end;
190 | end;
191 | end;
192 | end;
193 |
194 | function TDataStorageDataUtils.ZLibCompress(const AText: string): string;
195 | var
196 | LText: TBytes;
197 | LSSInput, LSSOutput: TStringStream;
198 | LZStream: TZCompressionStream;
199 | begin
200 | Result := '';
201 |
202 | LSSInput := TStringStream.Create(AText, TEncoding.UTF8);
203 | LSSOutput := TStringStream.Create;
204 | try
205 | LZStream := TZCompressionStream.Create(TCompressionLevel.clMax, LSSOutput);
206 | try
207 | LZStream.CopyFrom(LSSInput, LSSInput.Size);
208 | finally
209 | LZStream.Free;
210 | end;
211 |
212 | LText := TNetEncoding.Base64.Encode(LSSOutput.Bytes);
213 |
214 | Result := TEncoding.UTF8.GetString(LText);
215 | finally
216 | LSSInput.Free;
217 | LSSOutput.Free;
218 | end;
219 | end;
220 |
221 | function TDataStorageDataUtils.ZLibDecompress(const AText: string): string;
222 | var
223 | LText: TBytes;
224 | LSSInput, LSSOutput: TStringStream;
225 | LZStream: TZDecompressionStream;
226 | begin
227 | Result := '';
228 |
229 | try
230 | LText := TNetEncoding.Base64.Decode(TEncoding.UTF8.GetBytes(AText));
231 |
232 | LSSInput := TStringStream.Create(LText);
233 | LSSOutput := TStringStream.Create;
234 | try
235 | LZStream := TZDecompressionStream.Create(LSSInput);
236 | try
237 | LSSOutput.CopyFrom(LZStream, LZStream.Size);
238 | finally
239 | LZStream.Free;
240 | end;
241 |
242 | Result := LSSOutput.DataString;
243 | finally
244 | LSSInput.Free;
245 | LSSOutput.Free;
246 | end;
247 | except
248 | end;
249 | end;
250 |
251 | function TDataStorageDataUtils.JsonToObject(const AClassName: string; AJSON: TJSONObject): TValue;
252 | var
253 | LClass: TRttiType;
254 | LClassInstance: TRttiInstanceType;
255 | LObject: TObject;
256 | LField: TRttiField;
257 | LValue: TValue;
258 | begin
259 | LClass := TDataStorageRTTI.FindAnyClass(AClassName, tkClass);
260 |
261 | if not Assigned(LClass) then
262 | raise EDataStorageException.CreateFmt('Type (%s) not found!', [AClassName]);
263 |
264 | LClassInstance := TRttiContext.Create.GetType(LClass.Handle).AsInstance;
265 | LObject := LClassInstance.MetaclassType.Create;
266 |
267 | for LField in LClassInstance.GetFields do
268 | begin
269 | if not Assigned(AJSON.Values[LField.Name]) then
270 | Continue;
271 |
272 | LValue := JSONValueToTValue(AJSON.GetValue(LField.Name), LField.FieldType);
273 | LField.SetValue(LObject, LValue);
274 | end;
275 |
276 | Result := LObject;
277 | end;
278 |
279 | function TDataStorageDataUtils.JsonToEnum(const AKeyEnum: string; const AValueEnum: string): TValue;
280 | var
281 | LClass: TRttiType;
282 | LEnumValueInt: Integer;
283 | begin
284 | LClass := TDataStorageRTTI.FindAnyClass(AKeyEnum, tkEnumeration);
285 |
286 | if not Assigned(LClass) then
287 | raise EDataStorageException.CreateFmt('Type (%s) not found!', [AKeyEnum]);
288 |
289 | LEnumValueInt := GetEnumValue(LClass.Handle, AValueEnum);
290 | TValue.Make(LEnumValueInt, LClass.Handle, Result);
291 | end;
292 |
293 | function TDataStorageDataUtils.JsonToRecord(const AKeyRecord: string; const AJSON: TJSONObject): TValue;
294 | var
295 | LClass: TRttiType;
296 | LClassInstance: TRttiRecordType;
297 | LRecord: TValue;
298 | LField: TRttiField;
299 | LValue: TValue;
300 | begin
301 | LClass := TDataStorageRTTI.FindAnyClass(AKeyRecord, tkRecord);
302 |
303 | if not Assigned(LClass) then
304 | raise EDataStorageException.CreateFmt('Type (%s) not found!', [AKeyRecord]);
305 |
306 | LClassInstance := TRttiContext.Create.GetType(LClass.Handle).AsRecord;
307 |
308 | TValue.Make(nil, LClassInstance.Handle, LRecord);
309 |
310 | for LField in LClassInstance.GetFields do
311 | begin
312 | if not Assigned(AJSON.Values[LField.Name]) then
313 | Continue;
314 |
315 | LValue := JSONValueToTValue(AJSON.GetValue(LField.Name), LField.FieldType);
316 |
317 | LField.SetValue(LRecord.GetReferenceToRawData, LValue);
318 | end;
319 |
320 | Result := LRecord;
321 | end;
322 |
323 | function TDataStorageDataUtils.JsonToArray(const AJSON: TJSONArray; const ARttiType: TRttiType): TValue;
324 | var
325 | I: Integer;
326 | LKeyTipo: string;
327 | LValue: TValue;
328 | LArrValue: TArray;
329 | LRttiType: TRttiType;
330 | LPTypeInfo: PTypeInfo;
331 | begin
332 | LPTypeInfo := ARttiType.Handle;
333 | LRttiType := nil;
334 |
335 | for I := 0 to Pred(AJSON.Count) do
336 | begin
337 | if I = 0 then
338 | begin
339 | LKeyTipo := (AJSON.Items[I] as TJSONObject).Pairs[0].JsonString.Value;
340 | LRttiType := TDataStorageRTTI.FindAnyClass(LKeyTipo);
341 | end;
342 |
343 | LValue := JSONValueToTValue((AJSON.Items[I] as TJSONObject).Pairs[0].JsonValue, LRttiType);
344 | LArrValue := Concat(LArrValue, [LValue]);
345 | end;
346 |
347 | Result := TValue.FromArray(LPTypeInfo, LArrValue);
348 | end;
349 |
350 | function TDataStorageDataUtils.JSONValueToTValue(const AJSON: TJSONValue; const ARttiType: TRttiType = nil): TValue;
351 | function ISOToDateTime(const ADateTime: string): TDateTime;
352 | begin
353 | if ADateTime.Contains('T') then
354 | Result := ISO8601ToDate(ADateTime, False)
355 | else
356 | Result := StrToDateTime(ADateTime);
357 | end;
358 |
359 | var
360 | LKey: string;
361 | LClassValue: TJSONObject;
362 | LEnumValue: string;
363 | LRecordValue: TJSONObject;
364 | LValueInt: Integer;
365 | LArrName: string;
366 | LArrType: TRttiType;
367 | begin
368 | if not Assigned(AJSON) then
369 | Exit(TValue.Empty);
370 |
371 | if AJSON is TJSONObject then
372 | begin
373 | LKey := ((AJSON as TJSONObject).Pairs[0].JsonValue as TJSONObject).Pairs[0].JsonString.Value;
374 |
375 | case IndexStr(AJSON.GetValue.Pairs[0].JsonString.Value, ['ds_data_object', 'ds_data_enumerator', 'ds_data_record']) of
376 | 0:
377 | begin
378 | LClassValue := ((AJSON as TJSONObject).Pairs[0].JsonValue as TJSONObject).Pairs[0].JsonValue as TJSONObject;
379 | Result := JsonToObject(LKey, LClassValue);
380 | end;
381 |
382 | 1:
383 | begin
384 | LEnumValue := ((AJSON as TJSONObject).Pairs[0].JsonValue as TJSONObject).Pairs[0].JsonValue.Value;
385 | Result := JsonToEnum(LKey, LEnumValue);
386 | end;
387 |
388 | 2:
389 | begin
390 | LRecordValue := ((AJSON as TJSONObject).Pairs[0].JsonValue as TJSONObject).Pairs[0].JsonValue as TJSONObject;
391 | Result := JsonToRecord(LKey, LRecordValue);
392 | end;
393 | else
394 | Result := JSONValueToTValue(((AJSON as TJSONObject).Pairs[0].JsonValue as TJSONObject).Pairs[0].JsonValue, ARttiType);
395 | end
396 | end
397 | else
398 | begin
399 | if Assigned(ARttiType) then
400 | begin
401 | case ARttiType.TypeKind of
402 | tkInteger, tkInt64:
403 | Result := AJSON.AsType;
404 |
405 | tkChar, tkWChar, tkLString, tkString, tkWString, tkUString, tkVariant:
406 | Result := AJSON.AsType;
407 |
408 | tkEnumeration:
409 | begin
410 | if AJSON is TJSONBool then
411 | Result := AJSON.AsType
412 | end;
413 |
414 | tkFloat:
415 | begin
416 | case IndexStr(ARttiType.Name, ['TDateTime', 'TDate', 'TTime', 'TTimeStamp']) of
417 | 0: Result := ISOToDateTime(AJSON.AsType);
418 | 1: Result := StrToDate(AJSON.AsType, GetFormatSettings);
419 | 2: Result := StrToTime(AJSON.AsType, GetFormatSettings);
420 | 3: Result := ISOToDateTime(AJSON.AsType);
421 | else
422 | Result := AJSON.AsType;
423 | end;
424 | end;
425 |
426 | tkArray, tkDynArray:
427 | Result := JsonToArray(AJSON as TJSONArray, ARttiType);
428 | end;
429 | end
430 | else
431 | begin
432 | if AJSON is TJSONBool then
433 | Result := AJSON.AsType
434 | else
435 | if AJSON is TJSONNumber then
436 | begin
437 | if TryStrToInt(AJSON.ToString, LValueInt) then
438 | Result := AJSON.AsType
439 | else
440 | Result := AJSON.AsType;
441 | end
442 | else
443 | if AJSON is TJSONString then
444 | Result := AJSON.AsType
445 | else
446 | if AJSON is TJSONArray then
447 | begin
448 | LArrName := (AJSON as TJSONArray).Items[0].AsType.Pairs[0].JsonString.Value;
449 | LArrType := TDataStorageRTTI.FindAnyClassArray(LArrName);
450 | Result := JsonToArray(AJSON as TJSONArray, LArrType);
451 | end;
452 | end;
453 | end;
454 | end;
455 |
456 | function TDataStorageDataUtils.GetFormatSettings: TFormatSettings;
457 | begin
458 | Result.DateSeparator := '-';
459 | Result.ShortDateFormat := 'yyyy-mm-dd';
460 | Result.TimeSeparator := ':';
461 | Result.LongTimeFormat := 'hh:nn:ss';
462 | end;
463 |
464 | { TDataStorageRTTI }
465 |
466 | class function TDataStorageRTTI.FindAnyClassArray(const AName: string): TRttiType;
467 | var
468 | LRttiContext: TRttiContext;
469 | LRttiType: TRttiType;
470 | LARttiType: TArray;
471 | begin
472 | Result := nil;
473 |
474 | LRttiContext := TRttiContext.Create;
475 | LARttiType := LRttiContext.GetTypes;
476 |
477 | try
478 | for LRttiType in LARttiType do
479 | begin
480 | if StartsText('tarray<' + AName.ToLower, LRttiType.Name.ToLower) or EndsText(AName.ToLower + '>', LRttiType.Name.ToLower) then
481 | begin
482 | Result := LRttiType;
483 | Break;
484 | end;
485 | end;
486 | finally
487 | LRttiContext.Free;
488 | end;
489 | end;
490 |
491 | class function TDataStorageRTTI.FindAnyClass(const AName: string): TRttiType;
492 | var
493 | LRttiContext: TRttiContext;
494 | LRttiType: TRttiType;
495 | LARttiType: TArray;
496 | begin
497 | Result := nil;
498 |
499 | LRttiContext := TRttiContext.Create;
500 | LARttiType := LRttiContext.GetTypes;
501 |
502 | try
503 | for LRttiType in LARttiType do
504 | begin
505 | if (SameStr(AName.ToLower, LRttiType.Name.ToLower)) then
506 | begin
507 | Result := LRttiType;
508 | Break;
509 | end;
510 | end;
511 | finally
512 | LRttiContext.Free;
513 | end;
514 | end;
515 |
516 | class function TDataStorageRTTI.FindAnyClass(const AName: string; const ATypeKind: TTypeKind): TRttiType;
517 | var
518 | LRttiContext: TRttiContext;
519 | LRttiType: TRttiType;
520 | LARttiType: TArray;
521 | begin
522 | Result := nil;
523 |
524 | LRttiContext := TRttiContext.Create;
525 | LARttiType := LRttiContext.GetTypes;
526 |
527 | try
528 | for LRttiType in LARttiType do
529 | if (LRttiType.TypeKind = ATypeKind) and (EndsText(AName, LRttiType.Name)) then
530 | begin
531 | Result := LRttiType;
532 | Break;
533 | end;
534 | finally
535 | LRttiContext.Free;
536 | end;
537 | end;
538 |
539 | end.
540 |
--------------------------------------------------------------------------------
/src/DataStorage.Data.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.Data;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf, DataStorage.Data.Utils, System.JSON,
14 | System.Generics.Collections, System.RTTI, System.TypInfo, System.SysUtils, System.Classes, System.IOUtils;
15 |
16 | type
17 | TDataStorageData = class(TInterfacedObject, IDataStorageData)
18 | private
19 | [Weak]
20 | FDataBase: IDataStorageDataBase;
21 | FUtils: TDataStorageDataUtils;
22 | public
23 | function SetJSON(const AJSON: string): IDataStorageData;
24 | function ToJSON: string;
25 | function LoadFromFile(const AFileName: string; const AEncrypt: Boolean = True): IDataStorageData;
26 | function SaveToFile(const AFileName: string; const AEncrypt: Boolean = True): IDataStorageData;
27 | function &End: IDataStorage;
28 |
29 | constructor Create(const ADataBase: IDataStorageDataBase);
30 | destructor Destroy; override;
31 | end;
32 |
33 | implementation
34 |
35 | { TDataStorageData }
36 |
37 | constructor TDataStorageData.Create(const ADataBase: IDataStorageDataBase);
38 | begin
39 | FDataBase := ADataBase;
40 | FUtils := TDataStorageDataUtils.Create;
41 | end;
42 |
43 | destructor TDataStorageData.Destroy;
44 | begin
45 | FUtils.Free;
46 | inherited;
47 | end;
48 |
49 | function TDataStorageData.SetJSON(const AJSON: string): IDataStorageData;
50 | var
51 | LJV: TJSONValue;
52 | LJO: TJSONObject;
53 | begin
54 | Result := Self;
55 |
56 | try
57 | LJV := TJSONObject.ParseJSONValue(AJSON);
58 | except
59 | Exit
60 | end;
61 |
62 | if not Assigned(LJV) then
63 | Exit;
64 |
65 | if not(LJV is TJSONObject) then
66 | begin
67 | LJV.Free;
68 | Exit;
69 | end;
70 |
71 | LJO := LJV as TJSONObject;
72 | try
73 | FUtils.TJSONObjectToDataBase(FDataBase, LJO);
74 | finally
75 | LJO.Free;
76 | end;
77 | end;
78 |
79 | function TDataStorageData.ToJSON: string;
80 | var
81 | LJO: TJSONObject;
82 | LDataBases: TDataStorageDictDataBase;
83 | LPairDataBase: TPair;
84 | LTables: TDataStorageDictTable;
85 | LPairTable: TPair;
86 | LItems: TDataStorageDictItem;
87 | LPairItem: TPair;
88 | LJOValue: TJSONObject;
89 | LValue: TValue;
90 | begin
91 | LJO := TJSONObject.Create;
92 | try
93 | LDataBases := FDataBase.DataBase.ListDictionary;
94 |
95 | for LPairDataBase in LDataBases do
96 | begin
97 | LJO.AddPair(LPairDataBase.Key, TJSONObject.Create);
98 |
99 | LTables := LPairDataBase.Value.Table.ListDictionary;
100 | for LPairTable in LTables do
101 | begin
102 | LJOValue :=
103 | LJO.GetValue(LPairDataBase.Key)
104 | .AddPair(LPairTable.Key, TJSONObject.Create)
105 | .GetValue(LPairTable.Key);
106 |
107 | LItems := LPairTable.Value.Item.ListDictionary;
108 | for LPairItem in LItems do
109 | begin
110 | LValue := LPairItem.Value.GetValue;
111 | FUtils.TValueToJSONObject(LPairItem.Key, LValue, LJOValue);
112 | end;
113 | end;
114 | end;
115 |
116 | Result := LJO.ToString;
117 | finally
118 | LJO.Free;
119 | end;
120 | end;
121 |
122 | function TDataStorageData.LoadFromFile(const AFileName: string; const AEncrypt: Boolean = True): IDataStorageData;
123 | var
124 | LText: string;
125 | begin
126 | Result := Self;
127 |
128 | if Trim(AFileName).IsEmpty then
129 | raise EDataStorageException.Create('Filename is empty!');
130 |
131 | if not TFile.Exists(AFileName) then
132 | Exit;
133 |
134 | try
135 | LText := TFile.ReadAllText(AFileName);
136 |
137 | if AEncrypt then
138 | LText := FUtils.ZLibDecompress(LText);
139 | except
140 | Exit;
141 | end;
142 |
143 | SetJSON(LText);
144 | end;
145 |
146 | function TDataStorageData.SaveToFile(const AFileName: string; const AEncrypt: Boolean = True): IDataStorageData;
147 | var
148 | LText: string;
149 | LStringStream: TStringStream;
150 | begin
151 | Result := Self;
152 |
153 | if Trim(AFileName).IsEmpty then
154 | raise EDataStorageException.Create('Filename is empty!');
155 |
156 | if TFile.Exists(AFileName) then
157 | TFile.Delete(AFileName);
158 |
159 | LText := ToJSON;
160 |
161 | try
162 | if AEncrypt then
163 | LText := FUtils.ZLibCompress(LText);
164 | except
165 | Exit;
166 | end;
167 |
168 | LStringStream := TStringStream.Create(LText);
169 | try
170 | LStringStream.SaveToFile(AFileName);
171 | finally
172 | LStringStream.Free;
173 | end;
174 | end;
175 |
176 | function TDataStorageData.&End: IDataStorage;
177 | begin
178 | Result := FDataBase.&End;
179 | end;
180 |
181 | end.
182 |
--------------------------------------------------------------------------------
/src/DataStorage.DataBase.Utils.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.DataBase.Utils;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf,
14 | System.Generics.Collections;
15 |
16 | type
17 | TDataStorageDataBaseUtils = class(TInterfacedObject, IDataStorageDataBaseUtils)
18 | private
19 | [Weak]
20 | FDataBase: IDataStorageDataBase;
21 | FDictDataBase: TDataStorageDictDataBase;
22 | public
23 | function Count: Integer;
24 | function IsExist(const ADataBase: string): Boolean;
25 | function ListKey: TArray;
26 | function ListDictionary: TDataStorageDictDataBase;
27 | function Clear: IDataStorageDataBaseUtils;
28 | function Remove(const ADataBase: string): IDataStorageDataBaseUtils;
29 | function &End: IDataStorageDataBase;
30 |
31 | constructor Create(const ADataBase: IDataStorageDataBase; const ADictDataBase: TDataStorageDictDataBase);
32 | destructor Destroy; override;
33 | end;
34 |
35 | implementation
36 |
37 | { TDataStorageDataBaseUtils }
38 |
39 | constructor TDataStorageDataBaseUtils.Create(const ADataBase: IDataStorageDataBase; const ADictDataBase: TDataStorageDictDataBase);
40 | begin
41 | FDataBase := ADataBase;
42 | FDictDataBase := ADictDataBase;
43 | end;
44 |
45 | destructor TDataStorageDataBaseUtils.Destroy;
46 | begin
47 | inherited;
48 | end;
49 |
50 | function TDataStorageDataBaseUtils.Count: Integer;
51 | begin
52 | Result := FDictDataBase.Count;
53 | end;
54 |
55 | function TDataStorageDataBaseUtils.ListKey: TArray;
56 | begin
57 | Result := FDictDataBase.Keys.ToArray;
58 | end;
59 |
60 | function TDataStorageDataBaseUtils.ListDictionary: TDataStorageDictDataBase;
61 | begin
62 | Result := FDictDataBase;
63 | end;
64 |
65 | function TDataStorageDataBaseUtils.IsExist(const ADataBase: string): Boolean;
66 | begin
67 | Result := FDictDataBase.ContainsKey(ADataBase);
68 | end;
69 |
70 | function TDataStorageDataBaseUtils.Clear: IDataStorageDataBaseUtils;
71 | var
72 | LPairDataBase: TPair;
73 | begin
74 | Result := Self;
75 |
76 | for LPairDataBase in FDictDataBase do
77 | LPairDataBase.Value.Table.Clear;
78 |
79 | FDictDataBase.Clear;
80 | end;
81 |
82 | function TDataStorageDataBaseUtils.Remove(const ADataBase: string): IDataStorageDataBaseUtils;
83 | begin
84 | Result := Self;
85 |
86 | FDictDataBase.Remove(ADataBase);
87 | end;
88 |
89 | function TDataStorageDataBaseUtils.&End: IDataStorageDataBase;
90 | begin
91 | Result := FDataBase;
92 | end;
93 |
94 | end.
95 |
--------------------------------------------------------------------------------
/src/DataStorage.DataBase.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.DataBase;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf, DataStorage.DataBase.Utils, DataStorage.Table;
14 |
15 | type
16 | TDataStorageDataBase = class(TInterfacedObject, IDataStorageDataBase)
17 | private
18 | [Weak]
19 | FDataStorage: IDataStorage;
20 | FDict: TDataStorageDictDataBase;
21 | FUtils: IDataStorageDataBaseUtils;
22 | public
23 | function DataBase(const ADataBase: string): IDataStorageTable; overload;
24 | function DataBase: IDataStorageDataBaseUtils; overload;
25 | function &End: IDataStorage;
26 |
27 | constructor Create(const ADataStorage: IDataStorage);
28 | destructor Destroy; override;
29 | end;
30 |
31 | implementation
32 |
33 | { TDataStorageDataBase }
34 |
35 | constructor TDataStorageDataBase.Create(const ADataStorage: IDataStorage);
36 | begin
37 | FDataStorage := ADataStorage;
38 | FDict := TDataStorageDictDataBase.Create;
39 | FUtils := TDataStorageDataBaseUtils.Create(Self, FDict);
40 | end;
41 |
42 | destructor TDataStorageDataBase.Destroy;
43 | begin
44 | FDict.Free;
45 | inherited;
46 | end;
47 |
48 | function TDataStorageDataBase.DataBase(const ADataBase: string): IDataStorageTable;
49 | var
50 | LTable: IDataStorageTable;
51 | begin
52 | if not FDict.TryGetValue(ADataBase, LTable) then
53 | begin
54 | LTable := TDataStorageTable.Create(Self, ADataBase);
55 | FDict.AddOrSetValue(ADataBase, LTable);
56 | end;
57 |
58 | Result := LTable;
59 | end;
60 |
61 | function TDataStorageDataBase.DataBase: IDataStorageDataBaseUtils;
62 | begin
63 | Result := FUtils;
64 | end;
65 |
66 | function TDataStorageDataBase.&End: IDataStorage;
67 | begin
68 | Result := FDataStorage
69 | end;
70 |
71 | end.
72 |
--------------------------------------------------------------------------------
/src/DataStorage.Intf.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.Intf;
9 |
10 | interface
11 |
12 | uses
13 | System.Generics.Collections, System.Rtti;
14 |
15 | type
16 | TValue = System.Rtti.TValue;
17 |
18 | IDataStorage = interface;
19 | IDataStorageValue = interface;
20 | IDataStorageItem = interface;
21 | IDataStorageTable = interface;
22 | IDataStorageDataBase = interface;
23 |
24 | TDataStorageDictItem = TDictionary;
25 | TDataStorageDictTable = TDictionary;
26 | TDataStorageDictDataBase = TDictionary;
27 |
28 | IDataStorageData = interface
29 | ['{A0E2B65D-44BC-4D5F-8CC8-CB9E1A24775D}']
30 | function SetJSON(const AJSON: string): IDataStorageData;
31 | function ToJSON: string;
32 | function LoadFromFile(const AFileName: string; const AEncrypt: Boolean = True): IDataStorageData;
33 | function SaveToFile(const AFileName: string; const AEncrypt: Boolean = True): IDataStorageData;
34 | function &End: IDataStorage;
35 | end;
36 |
37 | IDataStorageValue = interface
38 | ['{08466C0A-D354-43B0-8138-BF451BCBEB80}']
39 | function GetKey: string;
40 | function GetValue: TValue;
41 | function SetValue(const AValue: TValue): IDataStorageItem;
42 | end;
43 |
44 | IDataStorageItemUtils = interface
45 | ['{11A148C2-F357-4336-8DC7-3314CF63D82E}']
46 | function Count: Integer;
47 | function IsExist(const AItem: string): Boolean;
48 | function ListKey: TArray;
49 | function ListDictionary: TDataStorageDictItem;
50 | function Clear: IDataStorageItemUtils;
51 | function Remove(const AItem: string): IDataStorageItemUtils;
52 | function &End: IDataStorageItem;
53 | end;
54 |
55 | IDataStorageItem = interface
56 | ['{642D3B0A-2947-442A-BA4B-E60D4E504CCF}']
57 | function Item(const AItem: string): IDataStorageValue; overload;
58 | function Item: IDataStorageItemUtils; overload;
59 | function SetItem(const AItem: string; const AValue: TValue): IDataStorageItem;
60 | function GetItem(const AItem: string; out AValue: TValue): IDataStorageItem;
61 | function &End: IDataStorageTable;
62 | end;
63 |
64 | IDataStorageTableUtils = interface
65 | ['{3AC38CB9-EDF6-483E-B6CB-2DF1363425C2}']
66 | function Count: Integer;
67 | function IsExist(const ATable: string): Boolean;
68 | function ListKey: TArray;
69 | function ListDictionary: TDataStorageDictTable;
70 | function Clear: IDataStorageTableUtils;
71 | function Remove(const ATable: string): IDataStorageTableUtils;
72 | function &End: IDataStorageTable;
73 | end;
74 |
75 | IDataStorageTable = interface
76 | ['{2FF011E2-8D23-49DC-9B66-C9558E35F42E}']
77 | function Table(const ATable: string): IDataStorageItem; overload;
78 | function Table: IDataStorageTableUtils; overload;
79 | function &End: IDataStorageDataBase;
80 | end;
81 |
82 | IDataStorageDataBaseUtils = interface
83 | ['{E2D43D71-E1D5-4AB9-AE1B-F2DF25AAC34D}']
84 | function Count: Integer;
85 | function IsExist(const ADataBase: string): Boolean;
86 | function ListKey: TArray;
87 | function ListDictionary: TDataStorageDictDataBase;
88 | function Clear: IDataStorageDataBaseUtils;
89 | function Remove(const ADataBase: string): IDataStorageDataBaseUtils;
90 | function &End: IDataStorageDataBase;
91 | end;
92 |
93 | IDataStorageDataBase = interface
94 | ['{E43BB56A-6DCD-478C-AAE8-6C8DEBFD6A3A}']
95 | function DataBase(const ADataBase: string): IDataStorageTable; overload;
96 | function DataBase: IDataStorageDataBaseUtils; overload;
97 | function &End: IDataStorage;
98 | end;
99 |
100 | IDataStorage = interface
101 | ['{CA89BF56-20E4-40DC-9835-8BB75D5F5EC5}']
102 | function DataBase(const ADataBase: string): IDataStorageTable; overload;
103 | function DataBase: IDataStorageDataBaseUtils; overload;
104 | function Table(const ATable: string): IDataStorageItem; overload;
105 | function Table: IDataStorageTableUtils; overload;
106 | function Item(const AItem: string): IDataStorageValue; overload;
107 | function Item: IDataStorageItemUtils; overload;
108 | function Data: IDataStorageData;
109 | end;
110 |
111 | implementation
112 |
113 | end.
114 |
--------------------------------------------------------------------------------
/src/DataStorage.Item.Utils.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.Item.Utils;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf,
14 | System.Generics.Collections;
15 |
16 | type
17 | TDataStorageItemUtils = class(TInterfacedObject, IDataStorageItemUtils)
18 | private
19 | [Weak]
20 | FItem: IDataStorageItem;
21 | FDictItem: TDataStorageDictItem;
22 | public
23 | function Count: Integer;
24 | function IsExist(const AItem: string): Boolean;
25 | function ListKey: TArray;
26 | function ListDictionary: TDataStorageDictItem;
27 | function Clear: IDataStorageItemUtils;
28 | function Remove(const AItem: string): IDataStorageItemUtils;
29 | function &End: IDataStorageItem;
30 |
31 | constructor Create(const AItem: IDataStorageItem; const ADictItem: TDataStorageDictItem);
32 | destructor Destroy; override;
33 | end;
34 |
35 | implementation
36 |
37 | { TDataStorageItemUtils }
38 |
39 | constructor TDataStorageItemUtils.Create(const AItem: IDataStorageItem; const ADictItem: TDataStorageDictItem);
40 | begin
41 | FItem := AItem;
42 | FDictItem := ADictItem;
43 | end;
44 |
45 | destructor TDataStorageItemUtils.Destroy;
46 | begin
47 | inherited;
48 | end;
49 |
50 | function TDataStorageItemUtils.Count: Integer;
51 | begin
52 | Result := FDictItem.Count;
53 | end;
54 |
55 | function TDataStorageItemUtils.ListKey: TArray;
56 | begin
57 | Result := FDictItem.Keys.ToArray;
58 | end;
59 |
60 | function TDataStorageItemUtils.ListDictionary: TDataStorageDictItem;
61 | begin
62 | Result := FDictItem;
63 | end;
64 |
65 | function TDataStorageItemUtils.IsExist(const AItem: string): Boolean;
66 | begin
67 | Result := FDictItem.ContainsKey(AItem);
68 | end;
69 |
70 | function TDataStorageItemUtils.Clear: IDataStorageItemUtils;
71 | begin
72 | Result := Self;
73 | FDictItem.Clear;
74 | end;
75 |
76 | function TDataStorageItemUtils.Remove(const AItem: string): IDataStorageItemUtils;
77 | begin
78 | Result := Self;
79 | FDictItem.Remove(AItem);
80 | end;
81 |
82 | function TDataStorageItemUtils.&End: IDataStorageItem;
83 | begin
84 | Result := FItem;
85 | end;
86 |
87 | end.
88 |
--------------------------------------------------------------------------------
/src/DataStorage.Item.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.Item;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf, DataStorage.Item.Utils, DataStorage.Value;
14 |
15 | type
16 | TDataStorageItem = class(TInterfacedObject, IDataStorageItem)
17 | private
18 | [Weak]
19 | FDataStorageTable: IDataStorageTable;
20 | FTable: string;
21 | FDict: TDataStorageDictItem;
22 | FUtils: IDataStorageItemUtils;
23 | public
24 | function Item(const AItem: string): IDataStorageValue; overload;
25 | function Item: IDataStorageItemUtils; overload;
26 | function SetItem(const AItem: string; const AValue: TValue): IDataStorageItem;
27 | function GetItem(const AItem: string; out AValue: TValue): IDataStorageItem;
28 | function &End: IDataStorageTable;
29 |
30 | constructor Create(const ADataStorageTable: IDataStorageTable; const ATable: string);
31 | destructor Destroy; override;
32 | end;
33 |
34 | implementation
35 |
36 | { TDataStorageItem }
37 |
38 | constructor TDataStorageItem.Create(const ADataStorageTable: IDataStorageTable; const ATable: string);
39 | begin
40 | FDataStorageTable := ADataStorageTable;
41 | FTable := ATable;
42 | FDict := TDataStorageDictItem.Create;
43 | FUtils := TDataStorageItemUtils.Create(Self, FDict);
44 | end;
45 |
46 | destructor TDataStorageItem.Destroy;
47 | begin
48 | FDict.Free;
49 | inherited;
50 | end;
51 |
52 | function TDataStorageItem.Item(const AItem: string): IDataStorageValue;
53 | var
54 | LValue: IDataStorageValue;
55 | begin
56 | if not FDict.TryGetValue(AItem, LValue) then
57 | begin
58 | LValue := TDataStorageValue.Create(Self, AItem);
59 | FDict.AddOrSetValue(AItem, LValue);
60 | end;
61 |
62 | Result := LValue;
63 | end;
64 |
65 | function TDataStorageItem.Item: IDataStorageItemUtils;
66 | begin
67 | Result := FUtils;
68 | end;
69 |
70 | function TDataStorageItem.SetItem(const AItem: string; const AValue: TValue): IDataStorageItem;
71 | begin
72 | Result := Item(AItem).SetValue(AValue);
73 | end;
74 |
75 | function TDataStorageItem.GetItem(const AItem: string; out AValue: TValue): IDataStorageItem;
76 | begin
77 | Result := Self;
78 | AValue := Item(AItem).GetValue;
79 | end;
80 |
81 | function TDataStorageItem.&End: IDataStorageTable;
82 | begin
83 | Result := FDataStorageTable;
84 | end;
85 |
86 | end.
87 |
--------------------------------------------------------------------------------
/src/DataStorage.Table.Utils.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.Table.Utils;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf,
14 | System.Generics.Collections;
15 |
16 | type
17 | TDataStorageTableUtils = class(TInterfacedObject, IDataStorageTableUtils)
18 | private
19 | [Weak]
20 | FTable: IDataStorageTable;
21 | FDictTable: TDataStorageDictTable;
22 | public
23 | function Count: Integer;
24 | function IsExist(const ATable: string): Boolean;
25 | function ListKey: TArray;
26 | function ListDictionary: TDataStorageDictTable;
27 | function Clear: IDataStorageTableUtils;
28 | function Remove(const ATable: string): IDataStorageTableUtils;
29 | function &End: IDataStorageTable;
30 |
31 | constructor Create(const ATable: IDataStorageTable; const ADictTable: TDataStorageDictTable);
32 | destructor Destroy; override;
33 | end;
34 |
35 | implementation
36 |
37 | { TDataStorageTableUtils }
38 |
39 | constructor TDataStorageTableUtils.Create(const ATable: IDataStorageTable; const ADictTable: TDataStorageDictTable);
40 | begin
41 | FTable := ATable;
42 | FDictTable := ADictTable;
43 | end;
44 |
45 | destructor TDataStorageTableUtils.Destroy;
46 | begin
47 | inherited;
48 | end;
49 |
50 | function TDataStorageTableUtils.Count: Integer;
51 | begin
52 | Result := FDictTable.Count;
53 | end;
54 |
55 | function TDataStorageTableUtils.ListKey: TArray;
56 | begin
57 | Result := FDictTable.Keys.ToArray;
58 | end;
59 |
60 | function TDataStorageTableUtils.ListDictionary: TDataStorageDictTable;
61 | begin
62 | Result := FDictTable;
63 | end;
64 |
65 | function TDataStorageTableUtils.IsExist(const ATable: string): Boolean;
66 | begin
67 | Result := FDictTable.ContainsKey(ATable);
68 | end;
69 |
70 | function TDataStorageTableUtils.Clear: IDataStorageTableUtils;
71 | var
72 | LPairItem: TPair;
73 | begin
74 | Result := Self;
75 |
76 | for LPairItem in FDictTable do
77 | LPairItem.Value.Item.Clear;
78 |
79 | FDictTable.Clear;
80 | end;
81 |
82 | function TDataStorageTableUtils.Remove(const ATable: string): IDataStorageTableUtils;
83 | begin
84 | Result := Self;
85 | FDictTable.Remove(ATable);
86 | end;
87 |
88 | function TDataStorageTableUtils.&End: IDataStorageTable;
89 | begin
90 | Result := FTable;
91 | end;
92 |
93 | end.
94 |
--------------------------------------------------------------------------------
/src/DataStorage.Table.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.Table;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf, DataStorage.Table.Utils, DataStorage.Item;
14 |
15 | type
16 | TDataStorageTable = class(TInterfacedObject, IDataStorageTable)
17 | private
18 | [Weak]
19 | FDataStorageDataBase: IDataStorageDataBase;
20 | FDataBase: string;
21 | FDict: TDataStorageDictTable;
22 | FUtils: IDataStorageTableUtils;
23 | public
24 | function Table(const ATable: string): IDataStorageItem; overload;
25 | function Table: IDataStorageTableUtils; overload;
26 | function &End: IDataStorageDataBase;
27 |
28 | constructor Create(const ADataStorageDataBase: IDataStorageDataBase; const ADataBase: string);
29 | destructor Destroy; override;
30 | end;
31 |
32 | implementation
33 |
34 | { TDataStorageTable }
35 |
36 | constructor TDataStorageTable.Create(const ADataStorageDataBase: IDataStorageDataBase; const ADataBase: string);
37 | begin
38 | FDataStorageDataBase := ADataStorageDataBase;
39 | FDataBase := ADataBase;
40 | FDict := TDataStorageDictTable.Create;
41 | FUtils := TDataStorageTableUtils.Create(Self, FDict);
42 | end;
43 |
44 | destructor TDataStorageTable.Destroy;
45 | begin
46 | FDict.Free;
47 | inherited;
48 | end;
49 |
50 | function TDataStorageTable.Table(const ATable: string): IDataStorageItem;
51 | var
52 | LItem: IDataStorageItem;
53 | begin
54 | if not FDict.TryGetValue(ATable, LItem) then
55 | begin
56 | LItem := TDataStorageItem.Create(Self, ATable);
57 | FDict.AddOrSetValue(ATable, LItem);
58 | end;
59 |
60 | Result := LItem;
61 | end;
62 |
63 | function TDataStorageTable.Table: IDataStorageTableUtils;
64 | begin
65 | Result := FUtils;
66 | end;
67 |
68 | function TDataStorageTable.&End: IDataStorageDataBase;
69 | begin
70 | Result := FDataStorageDataBase
71 | end;
72 |
73 | end.
74 |
--------------------------------------------------------------------------------
/src/DataStorage.Value.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage.Value;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf, System.SysUtils, System.Rtti;
14 |
15 | type
16 | TDataStorageValue = class(TInterfacedObject, IDataStorageValue)
17 | private
18 | [Weak]
19 | FItem: IDataStorageItem;
20 | FKey: string;
21 | FValue: TValue;
22 |
23 | procedure ObjectFinalize;
24 | public
25 | function GetKey: string;
26 | function GetValue: TValue;
27 | function SetValue(const AValue: TValue): IDataStorageItem;
28 |
29 | constructor Create(const AItem: IDataStorageItem; const AKey: string);
30 | destructor Destroy; override;
31 | end;
32 |
33 | implementation
34 |
35 | { TDataStorageValue }
36 |
37 | constructor TDataStorageValue.Create(const AItem: IDataStorageItem; const AKey: string);
38 | begin
39 | FItem := AItem;
40 | FKey := AKey;
41 | FValue := '';
42 | end;
43 |
44 | destructor TDataStorageValue.Destroy;
45 | begin
46 | ObjectFinalize;
47 | inherited;
48 | end;
49 |
50 | function TDataStorageValue.GetKey: string;
51 | begin
52 | Result := FKey;
53 | end;
54 |
55 | function TDataStorageValue.GetValue: TValue;
56 | begin
57 | Result := FValue;
58 | end;
59 |
60 | function TDataStorageValue.SetValue(const AValue: TValue): IDataStorageItem;
61 | begin
62 | Result := FItem;
63 |
64 | ObjectFinalize;
65 |
66 | FValue := AValue;
67 | end;
68 |
69 | procedure TDataStorageValue.ObjectFinalize;
70 | var
71 | LObject: TObject;
72 | begin
73 | if FValue.IsObject then
74 | begin
75 | LObject := FValue.AsObject;
76 | try
77 | if Assigned(LObject) then
78 | LObject.Free;
79 | except
80 | end;
81 | end;
82 | end;
83 |
84 | end.
85 |
--------------------------------------------------------------------------------
/src/DataStorage.pas:
--------------------------------------------------------------------------------
1 | {
2 | *************************************
3 | Created by Danilo Lucas
4 | Github - https://github.com/dliocode
5 | *************************************
6 | }
7 |
8 | unit DataStorage;
9 |
10 | interface
11 |
12 | uses
13 | DataStorage.Intf, DataStorage.DataBase, DataStorage.Data;
14 |
15 | type
16 | TValue = DataStorage.Intf.TValue;
17 | IDataStorage = DataStorage.Intf.IDataStorage;
18 |
19 | TDataStorage = class(TInterfacedObject, IDataStorage)
20 | private
21 | FDataStorageDataBase: IDataStorageDataBase;
22 | FDataStorageData: IDataStorageData;
23 | class var FInstance: IDataStorage;
24 | public
25 | function DataBase(const ADataBase: string): IDataStorageTable; overload;
26 | function DataBase: IDataStorageDataBaseUtils; overload;
27 | function Table(const ATable: string): IDataStorageItem; overload;
28 | function Table: IDataStorageTableUtils; overload;
29 | function Item(const AItem: string): IDataStorageValue; overload;
30 | function Item: IDataStorageItemUtils; overload;
31 | function Data: IDataStorageData;
32 |
33 | constructor Create;
34 | destructor Destroy; override;
35 |
36 | class function New: IDataStorage;
37 | end;
38 |
39 | implementation
40 |
41 | { TDataStorage }
42 |
43 | class function TDataStorage.New: IDataStorage;
44 | begin
45 | if not Assigned(FInstance) then
46 | FInstance := TDataStorage.Create;
47 |
48 | Result := FInstance;
49 | end;
50 |
51 | constructor TDataStorage.Create;
52 | begin
53 | FDataStorageDataBase := TDataStorageDataBase.Create(Self);
54 | FDataStorageData := TDataStorageData.Create(FDataStorageDataBase);
55 | end;
56 |
57 | destructor TDataStorage.Destroy;
58 | begin
59 | inherited;
60 | end;
61 |
62 | function TDataStorage.DataBase(const ADataBase: string): IDataStorageTable;
63 | begin
64 | Result := FDataStorageDataBase.DataBase(ADataBase);
65 | end;
66 |
67 | function TDataStorage.DataBase: IDataStorageDataBaseUtils;
68 | begin
69 | Result := FDataStorageDataBase.DataBase;
70 | end;
71 |
72 | function TDataStorage.Table(const ATable: string): IDataStorageItem;
73 | begin
74 | Result := DataBase('datastorage_default').Table(ATable);
75 | end;
76 |
77 | function TDataStorage.Table: IDataStorageTableUtils;
78 | begin
79 | Result := DataBase('datastorage_default').Table;
80 | end;
81 |
82 | function TDataStorage.Item(const AItem: string): IDataStorageValue;
83 | begin
84 | Result := Table('datastorage_default').Item(AItem);
85 | end;
86 |
87 | function TDataStorage.Item: IDataStorageItemUtils;
88 | begin
89 | Result := Table('datastorage_default').Item;
90 | end;
91 |
92 | function TDataStorage.Data: IDataStorageData;
93 | begin
94 | Result := FDataStorageData;
95 | end;
96 |
97 | end.
98 |
--------------------------------------------------------------------------------