-
Notifications
You must be signed in to change notification settings - Fork 0
/
InspectDelphi.pas
1974 lines (1569 loc) · 51.1 KB
/
InspectDelphi.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{**********************************************}
{ Delphi Inspect FireMonkey app }
{**********************************************}
unit InspectDelphi platform;
{$I InspectDefines.inc}
interface
uses
System.Classes, System.Types, System.UITypes, System.Generics.Collections,
FMX.Types;
type
TInspectDelphi=class
private
IStrings : TStrings;
procedure Add(const Text:String; const Value:Integer); overload;
procedure Add(const Text:String; const Value:Int64; const AFormat:String=''); overload;
procedure Add(const Text:String; const Value:UInt64; const AFormat:String=''); overload;
procedure Add(const Text:String=''); overload;
procedure Add(const Text,Value:String); overload;
procedure Add(const Text:String; const Value:Boolean); overload;
procedure Add(const Text:String; const Value:Pointer); overload;
procedure Add(const Text:String; const Value:Single); overload;
procedure Add(const Text:String; const Value:Double); overload;
procedure Add(const Text:String; const Value:Extended); overload;
procedure Add(const Text: String; const Value: TRectF); overload;
procedure Add(const Text: String; const Value: TSizeF); overload;
// Not an Add overload because clashes with Add(.. Value:Single)
procedure AddDate(const Text:String; const Value:TDate); //overload;
{$IF FireMonkeyVersion>20}
procedure Add(const Text:String; const Value:TRect); overload;
{$ENDIF}
procedure Add(const Text:String; const ASize:TSize); overload;
procedure Add(const Text:String; const AStrings:Array of String); overload;
procedure Add(const Text:String; const AStrings:TArray<String>); overload;
procedure AddDBXDrivers;
procedure AddHeader(const Text:String);
function BidiMode:String;
procedure DoDatabase;
procedure DoEncoding;
procedure DoFireMonkey;
procedure DoHardware;
procedure DoLocale;
procedure DoMath;
procedure DoOS;
procedure DoPaths;
procedure DoSystem;
public
class procedure AddAll(const Dest:TStrings);
class procedure AddDB(const Dest:TStrings);
class procedure AddFireMonkey(const Dest:TStrings);
class procedure AddHardware(const Dest:TStrings);
class procedure AddLocale(const Dest:TStrings);
class procedure AddMath(const Dest:TStrings);
class procedure AddOS(const Dest:TStrings);
class procedure AddPaths(const Dest:TStrings);
class procedure AddSystem(const Dest:TStrings);
end;
implementation
{$IFDEF ANDROID}
{$IF CompilerVersion>=28} // XE7 (not yet !)
// {$DEFINE HASPRINTER}
{$ENDIF}
{$ELSE}
{$DEFINE HASPRINTER}
{$ENDIF}
uses
{$IFDEF MSWINDOWS}
Windows,
{$ENDIF}
Data.DB,
Data.DBXCommon,
System.SysUtils, System.Diagnostics,
System.IOUtils, System.Math,
{$IFNDEF LINUX}
System.Sensors,
{$ENDIF}
System.TimeSpan, System.DateUtils,
FMX.Platform, FMX.Forms, FMX.Controls, FMX.Graphics,
{$IF FireMonkeyVersion>18}
FMX.BehaviorManager,
{$ENDIF}
{$IF FireMonkeyVersion>20}
System.Devices,
{$ENDIF}
{$IFDEF ANDROID}
FMX.Helpers.Android,
Androidapi.Helpers,
Androidapi.JNI.Os,
{$IF FireMonkeyVersion>=21}
Androidapi.JNI.App,
{$ENDIF}
{$IFDEF D24}
Androidapi.JNI.JavaTypes,
{$ENDIF}
{$ENDIF}
{$IFDEF IOS}
FMX.Helpers.iOS,
iOSapi.UIKit,
{$ENDIF}
{$IFDEF MACOSX}
FMX.Helpers.Mac,
{$ENDIF}
FMX.TextLayout, FMX.Media, FMX.Types3D, FMX.Gestures, FMX.Ani, FMX.Filter,
FMX.Filter.Custom, FMX.Filter.Standard,
{$IFDEF HASPRINTER}
FMX.Printer,
{$ENDIF}
REST.Client,
FireDAC.Stan.Consts,
{$IFDEF LINUX}
{$DEFINE NO_INTERBASE}
{$ENDIF}
{$IFDEF D28} // 11.3
{$IFNDEF CPUX64}
{$DEFINE NO_INTERBASE}
{$ENDIF}
{$ENDIF}
{$IFNDEF NO_INTERBASE}
IBX.IBXConst,
{$ENDIF}
System.ZLib, System.Threading,
{$IFNDEF LINUX}
System.Tether.Manager,
System.Sensors.Components,
System.Bluetooth, System.Bluetooth.Components,
{$ENDIF}
FMX.Styles, Unit_Utils, FMXTee.Constants;
function ReadableString(const S:String):String;
var C : Char;
begin
result:='';
for c in S do
if Ord(C)<32 then
result:=result+'$'+IntToStr(Ord(C))
else
result:=result+C;
end;
{ TInspectDelphi }
class procedure TInspectDelphi.AddAll(const Dest: TStrings);
begin
Dest.BeginUpdate;
try
AddSystem(Dest);
AddFireMonkey(Dest);
AddHardware(Dest);
AddLocale(Dest);
AddMath(Dest);
AddOS(Dest);
AddPaths(Dest);
AddDB(Dest);
finally
Dest.EndUpdate;
end;
end;
class procedure TInspectDelphi.AddDB(const Dest: TStrings);
var i : TInspectDelphi;
begin
i:=TInspectDelphi.Create;
try
i.IStrings:=Dest;
Dest.BeginUpdate;
i.DoDatabase;
finally
Dest.EndUpdate;
i.Free;
end;
end;
class procedure TInspectDelphi.AddSystem(const Dest: TStrings);
var i : TInspectDelphi;
begin
i:=TInspectDelphi.Create;
try
i.IStrings:=Dest;
Dest.BeginUpdate;
i.DoSystem;
finally
Dest.EndUpdate;
i.Free;
end;
end;
class procedure TInspectDelphi.AddFireMonkey(const Dest: TStrings);
var i : TInspectDelphi;
begin
i:=TInspectDelphi.Create;
try
i.IStrings:=Dest;
Dest.BeginUpdate;
i.DoFireMonkey;
finally
Dest.EndUpdate;
i.Free;
end;
end;
class procedure TInspectDelphi.AddHardware(const Dest: TStrings);
var i : TInspectDelphi;
begin
i:=TInspectDelphi.Create;
try
i.IStrings:=Dest;
Dest.BeginUpdate;
i.DoHardware;
finally
Dest.EndUpdate;
i.Free;
end;
end;
class procedure TInspectDelphi.AddLocale(const Dest: TStrings);
var i : TInspectDelphi;
begin
i:=TInspectDelphi.Create;
try
i.IStrings:=Dest;
Dest.BeginUpdate;
i.DoLocale;
finally
Dest.EndUpdate;
i.Free;
end;
end;
class procedure TInspectDelphi.AddMath(const Dest: TStrings);
var i : TInspectDelphi;
begin
i:=TInspectDelphi.Create;
try
i.IStrings:=Dest;
Dest.BeginUpdate;
i.DoMath;
finally
Dest.EndUpdate;
i.Free;
end;
end;
class procedure TInspectDelphi.AddOS(const Dest: TStrings);
var i : TInspectDelphi;
begin
i:=TInspectDelphi.Create;
try
i.IStrings:=Dest;
Dest.BeginUpdate;
i.DoOS;
finally
Dest.EndUpdate;
i.Free;
end;
end;
class procedure TInspectDelphi.AddPaths(const Dest: TStrings);
var i : TInspectDelphi;
begin
i:=TInspectDelphi.Create;
try
i.IStrings:=Dest;
Dest.BeginUpdate;
i.DoPaths;
finally
Dest.EndUpdate;
i.Free;
end;
end;
procedure TInspectDelphi.DoEncoding;
procedure AddEncoding(const AName:String; const AEncoding:TEncoding);
begin
AddHeader('TEncoding '+AName);
Add('CodePage',AEncoding.CodePage);
Add('EncodingName',AEncoding.EncodingName);
Add('IsSingleByte',AEncoding.IsSingleByte);
end;
var mbcs : TMBCSEncoding;
{$IFDEF POSIX}
cs: TCharSetEncoding;
{$ENDIF}
begin
AddEncoding('Default',TEncoding.Default);
AddEncoding('ANSI',TEncoding.ANSI);
AddEncoding('ASCII',TEncoding.ASCII);
AddEncoding('BigEndianUnicode',TEncoding.BigEndianUnicode);
AddEncoding('Unicode',TEncoding.Unicode);
AddEncoding('UTF7',TEncoding.UTF7);
AddEncoding('UTF8',TEncoding.UTF8);
mbcs:=TMBCSEncoding.Create;
try
AddEncoding('MBCS',mbcs);
finally
mbcs.Free;
end;
{$IFDEF POSIX}
cs:=TCharSetEncoding.Create;
try
AddEncoding('CharSet',cs);
finally
cs.Free;
end;
{$ENDIF}
Add;
end;
procedure TInspectDelphi.DoSystem;
{$IFDEF MSWINDOWS}
var AMemoryManagerState: TMemoryManagerState;
{$ENDIF}
begin
Add('Compiler Version',FloatToStr(CompilerVersion)+' ('+RADIDE+')');
Add('RTL Version',RTLVersion);
Add('Platform',PlatformToString);
Add;
Add('Now',DateTimeToStr(Now));
Add('Current Year',CurrentYear);
Add('Is Leap Year',IsLeapYear(CurrentYear));
Add('Min DateTime',DateTimeToStr(MinDateTime));
Add('Max DateTime',DateTimeToStr(MaxDateTime));
Add;
Add('GetCurrentDir',GetCurrentDir);
{$IF !Declared(FireMonkeyVersion)}
Add('ExeName',Application.ExeName);
{$ENDIF}
Add('ParamStr(0)',ParamStr(0));
Add('ParamCount',ParamCount);
Add('CurrentGroup',CurrentGroup);
Add('GetModuleName',GetModuleName(HInstance));
Add('ExceptionClass',ExceptionClass.ClassName);
Add('ExitCode',ExitCode);
Add('ErrorAddr',ErrorAddr);
Add('RandSeed',RandSeed);
Add('IsConsole',IsConsole);
Add('IsMultiThread',IsMultiThread);
Add('Processor Count',TThread.ProcessorCount);
Add('Is Single Processor',TThread.IsSingleProcessor);
{$IFDEF D22}
Add('Thread Pool Min',TThreadPool.Default.MinWorkerThreads);
Add('Thread Pool Max',TThreadPool.Default.MaxWorkerThreads);
{$ENDIF}
Add('FileMode',FileMode);
{$IF defined(LINUX) or defined(MACOS) or defined(ANDROID)}
Add('FileAccessRights',FileAccessRights);
Add('ArgCount',ArgCount);
Add('ArgValues',ArgValues);
Add('envp',envp);
{$ENDIF LINUX or MACOS or ANDROID}
{$IFDEF MSWINDOWS}
Add('HPrevInst',HPrevInst);
{$ENDIF}
Add('Main Instance',MainInstance);
Add('Main Thread ID',MainThreadID);
Add('Current Thread ID',TThread.CurrentThread.ThreadID);
Add('IsLibrary',IsLibrary);
{$IFDEF MSWINDOWS}
Add('CmdShow',CmdShow);
Add('CmdLine',String(CmdLine));
{$ENDIF}
Add('CPU Count',CPUCount);
{$IF defined(CPU64BITS)}
Add('Bits','64');
{$ENDIF}
{$IF defined(CPUX86) or defined(CPUX64)}
case TestSSE of
0: Add('No SSE');
1: Add('SSE');
else
Add('SSE2');
end;
case TestFDIV of
-1: Add('Flawed Pentium');
0: Add('Unknown Flawed Pentium');
else
Add('Not Flawed FDIV Pentium');
end;
case Test8086 of
CPUi386 : Add('CPU','i386');
CPUi486 : Add('CPU','i486');
CPUPentium: Add('CPU','Pentium');
else
Add('CPU','Unknown');
end;
Add('Test8087',Test8087);
{$ENDIF}
{$IF Defined(CPUARM)}
Add('DefaultFPSCR',DefaultFPSCR);
{$ENDIF}
{$IF Defined(CPUX86) or Defined(CPUX64)}
{$IFNDEF LINUX}
Add('Default8087CW',IntToHex(Default8087CW,4));
Add('DefaultMXCSR',IntToHex(DefaultMXCSR,4));
{$ENDIF}
{$ENDIF}
Add('HeapAllocFlags',IntToHex(HeapAllocFlags,4));
Add('DebugHook',DebugHook);
Add('JITEnable',JITEnable);
Add('NoErrMsg',NoErrMsg);
{$IF defined(LINUX) or defined(MACOS) or defined(ANDROID)}
Add('CoreDumpEnabled',CoreDumpEnabled);
{$ENDIF}
Add('DefaultSystemCodePage',DefaultSystemCodePage);
Add('DefaultUnicodeCodePage',DefaultUnicodeCodePage);
{$IFDEF MSWINDOWS}
Add('UTF8CompareLocale',UTF8CompareLocale);
{$ENDIF}
case DefaultTextLineBreakStyle of
tlbsLF: Add('DefaultTextLineBreakStyle','LF');
else
Add('DefaultTextLineBreakStyle','CRLF');
end;
Add('sLineBreak',ReadableString(sLineBreak));
Add('IsMemoryManagerSet',IsMemoryManagerSet);
Add('ReportMemoryLeaksOnShutdown',ReportMemoryLeaksOnShutdown);
Add('NeverSleepOnMMThreadContention',NeverSleepOnMMThreadContention);
{$IFDEF MSWINDOWS}
GetMemoryManagerState(AMemoryManagerState);
Add('AllocatedMediumBlockCount',AMemoryManagerState.AllocatedMediumBlockCount);
Add('TotalAllocatedMediumBlockSize',AMemoryManagerState.TotalAllocatedMediumBlockSize);
Add('ReservedMediumBlockAddressSpace',AMemoryManagerState.ReservedMediumBlockAddressSpace);
Add('AllocatedLargeBlockCount',AMemoryManagerState.AllocatedLargeBlockCount);
Add('TotalAllocatedLargeBlockSize',AMemoryManagerState.TotalAllocatedLargeBlockSize);
Add('ReservedLargeBlockAddressSpace',AMemoryManagerState.ReservedLargeBlockAddressSpace);
{$ENDIF}
{$IFDEF PC_MAPPED_EXCEPTIONS}
Add('IsUnwinderSet',IsUnwinderSet);
Add('AreOSExceptionsBlocked',AreOSExceptionsBlocked);
{$ENDIF}
{$IFDEF MSWINDOWS}
case GetMinimumBlockAlignment of
mba8Byte: Add('GetMinimumBlockAlignment','8 byte');
else
Add('GetMinimumBlockAlignment','16 byte');
end;
{$ENDIF}
{$IFNDEF ANDROID}
{$IFNDEF NEXTGEN}
Add('GetPackageTargets',GetPackageTargets(HInstance));
{$ENDIF}
{$ENDIF}
Add('FGetRound',FGetRound);
Add('FGetExceptFlag',FGetExceptFlag);
Add('FGetExceptMask',FGetExceptMask);
{$IF defined(CPUX86) or defined(CPUX64)}
{$IFNDEF LINUX}
Add('Get8087CW',Get8087CW);
Add('GetMXCSR',GetMXCSR);
{$ENDIF}
{$ENDIF}
{$IF defined(CPUARM)}
Add('GetFPSCR',GetFPSCR);
{$ENDIF}
{$IFDEF POSIX}
Add('GetACP',GetACP);
{$ENDIF}
{$IF RTLVersion>25}
Add('TMonitor.DefaultSpinCount',TMonitor.DefaultSpinCount);
{$ENDIF}
Add('HexDisplayPrefix',HexDisplayPrefix);
AddHeader('Stop Watch');
TStopwatch.StartNew;
Add('Frequency',TStopwatch.Frequency);
Add('High Resolution',TStopwatch.IsHighResolution);
Add;
Add('Min Time Span',''+TTimeSpan.MinValue);
Add('Max Time Span',''+TTimeSpan.MaxValue);
AddHeader('Compiler Options');
Add('Debug Info',{$IFOPT D+}True{$ELSE}False{$ENDIF});
Add('Local Symbols',{$IFOPT L+}True{$ELSE}False{$ENDIF});
Add('Optimizations',{$IFOPT O+}True{$ELSE}False{$ENDIF});
Add('Range Checks',{$IFOPT R+}True{$ELSE}False{$ENDIF});
Add('I/O Checks',{$IFOPT I+}True{$ELSE}False{$ENDIF});
Add('Overflow Checks',{$IFOPT Q+}True{$ELSE}False{$ENDIF});
Add('Assertions',{$IFOPT C+}True{$ELSE}False{$ENDIF});
AddHeader('Other');
Add('New GUID',TGUID.NewGuid.ToString);
Add('ZLib Version',String(ZLIB_VERSION));
{$IFDEF D28}
{$IFDEF ANDROID}
Add('Android Enable Realloc Memory Gap',EnableReallocMemoryGap);
{$ENDIF}
{$ENDIF}
Add;
end;
procedure TInspectDelphi.Add(const Text: String; const Value: Integer);
begin
IStrings.Add(Text+': '+IntToStr(Value));
end;
procedure TInspectDelphi.Add(const Text: String; const Value: TSizeF);
begin
IStrings.Add(Text+': X: '+Value.cx.ToString+' Y: '+Value.cy.ToString);
end;
procedure TInspectDelphi.Add(const Text: String; const Value: TRectF);
begin
IStrings.Add(Text+': Left: '+Value.Left.ToString+' Top: '+Value.Top.ToString+' '+
'Right: '+Value.Right.ToString+' Bottom: '+Value.Bottom.ToString);
end;
procedure TInspectDelphi.Add(const Text: String; const Value: Int64; const AFormat:String='');
begin
if AFormat='' then
IStrings.Add(Text+': '+IntToStr(Value))
else
IStrings.Add(Text+': '+FormatFloat(AFormat,Value));
end;
procedure TInspectDelphi.Add(const Text: String);
begin
IStrings.Add(Text);
end;
procedure TInspectDelphi.Add(const Text, Value: String);
begin
IStrings.Add(Text+': '+Value);
end;
procedure TInspectDelphi.Add(const Text: String; const Value: Boolean);
begin
IStrings.Add(Text+': '+BoolToStr(Value,True));
end;
procedure TInspectDelphi.Add(const Text: String; const Value: Pointer);
var P : NativeInt;
begin
P:=NativeInt(Value);
IStrings.Add(Text+': '+IntToHex(P,{$IFDEF CPUX64}8{$ELSE}4{$ENDIF}));
end;
procedure TInspectDelphi.Add(const Text: String; const Value: Single);
begin
IStrings.Add(Text+': '+FloatToStr(Value));
end;
function RectToString(const R: TRect): string;
begin
Result := '(' + IntToStr(R.Left) + ',' + IntToStr(R.Top) + ',' +
IntToStr(R.Right) + ',' + IntToStr(R.Bottom) + ')';
end;
{$IF FireMonkeyVersion>20}
procedure TInspectDelphi.Add(const Text: String; const Value: TRect);
begin
IStrings.Add(Text+': '+RectToString(Value));
end;
{$ENDIF}
procedure TInspectDelphi.Add(const Text: String; const ASize: TSize);
begin
IStrings.Add(Text+': Width='+IntToStr(ASize.Width)+', Height='+IntToStr(ASize.Height));
end;
procedure TInspectDelphi.Add(const Text: String;
const AStrings: array of String);
var s: String;
t: Integer;
begin
s:='';
for t := Low(AStrings) to High(AStrings) do
if t=Low(AStrings) then
s:=AStrings[t]
else
s:=s+' '+AStrings[t];
Add(Text,s);
end;
procedure TInspectDelphi.Add(const Text:String; const AStrings:TArray<String>);
var s: String;
t: Integer;
begin
s:='';
for t := Low(AStrings) to High(AStrings) do
if t=Low(AStrings) then
s:=AStrings[t]
else
s:=s+' '+AStrings[t];
Add(Text,s);
end;
procedure TInspectDelphi.Add(const Text: String; const Value: Double);
begin
IStrings.Add(Text+': '+FloatToStr(Value));
end;
procedure TInspectDelphi.Add(const Text: String; const Value: Extended);
begin
IStrings.Add(Text+': '+FloatToStr(Value));
end;
procedure TInspectDelphi.Add(const Text: String; const Value: UInt64;
const AFormat: String);
begin
if AFormat='' then
IStrings.Add(Text+': '+UIntToStr(Value))
else
IStrings.Add(Text+': '+FormatFloat(AFormat,Value));
end;
procedure TInspectDelphi.AddDate(const Text: String; const Value: TDate);
begin
IStrings.Add(Text+': '+DateToStr(Value));
end;
{$IF CompilerVersion>=28}
function DeviceClassToStr(const AClass:TDeviceInfo.TDeviceClass):String;
begin
case AClass of
TDeviceInfo.TDeviceClass.Unknown: result:='Unknown';
TDeviceInfo.TDeviceClass.Desktop: result:='Desktop';
TDeviceInfo.TDeviceClass.Phone: result:='Phone';
TDeviceInfo.TDeviceClass.MediaPlayer: result:='Media Player';
TDeviceInfo.TDeviceClass.Tablet: result:='Tablet';
TDeviceInfo.TDeviceClass.Automotive: result:='Automotive';
TDeviceInfo.TDeviceClass.Industrial: result:='Industrial';
TDeviceInfo.TDeviceClass.Embedded: result:='Embedded';
TDeviceInfo.TDeviceClass.Watch: result:='Watch';
TDeviceInfo.TDeviceClass.Glasses: result:='Glasses';
TDeviceInfo.TDeviceClass.Elf: result:='Elf';
TDeviceInfo.TDeviceClass.Dwarf: result:='Dwarf';
else
{TDeviceInfo.TDeviceClass.Wizard} result:='Wizard';
end;
end;
{$ENDIF}
function TInspectDelphi.BidiMode:String;
begin
case Application.BiDiMode of
bdLeftToRight: result:='Left to Right';
bdRightToLeft: result:='Right to Left';
bdRightToLeftNoAlign: result:='Right to Left No Align';
bdRightToLeftReadingOnly: result:='Right to Left Reading Only';
else
result:='(Unknown)';
end;
end;
procedure TInspectDelphi.DoFireMonkey;
procedure AddScrollingBehaviors(const ABehaviors:TScrollingBehaviours);
begin
if TScrollingBehaviour.BoundsAnimation in ABehaviors then
Add('BoundsAnimation scrolling behavior');
if TScrollingBehaviour.Animation in ABehaviors then
Add('Animation scrolling behavior');
if TScrollingBehaviour.TouchTracking in ABehaviors then
Add('TouchTracking scrolling behavior');
if TScrollingBehaviour.AutoShowing in ABehaviors then
Add('AutoShowing scrolling behavior');
end;
procedure AddOrientations(const AOrientations:TScreenOrientations);
begin
if TScreenOrientation.{$IF FireMonkeyVersion>18}Portrait{$ELSE}soPortrait{$ENDIF} in AOrientations then
Add('Portrait Orientation');
if TScreenOrientation.{$IF FireMonkeyVersion>18}Landscape{$ELSE}soLandscape{$ENDIF} in AOrientations then
Add('Landscape Orientation');
if TScreenOrientation.{$IF FireMonkeyVersion>18}InvertedPortrait{$ELSE}soInvertedPortrait{$ENDIF} in AOrientations then
Add('Inverted Portrait Orientation');
if TScreenOrientation.{$IF FireMonkeyVersion>18}InvertedLandscape{$ELSE}soInvertedLandscape{$ENDIF} in AOrientations then
Add('Inverted Landscape Orientation');
end;
procedure AddFilters;
var Categories,
Filters : TStrings;
t,tt : Integer;
begin
AddHeader('Filters');
Categories:=TStringList.Create;
try
TFilterManager.FillCategory(Categories);
for t := 0 to Categories.Count-1 do
begin
AddHeader(' '+Categories[t]);
Filters:=TStringList.Create;
try
TFilterManager.FillFiltersInCategory(Categories[t],Filters);
for tt := 0 to Filters.Count-1 do
Add(' '+Filters[tt]);
finally
Filters.Free;
end;
end;
finally
Categories.Free;
end;
end;
var
ScreenService: IFMXScreenService;
tmpStyle : TStyleDescription;
DeviceSrv: IFMXDeviceService;
LocaleService: IFMXLocaleService;
TextService: IFMXTextService;
tmpCanvas : TCanvas;
{$IF FireMonkeyVersion>20}
DeviceBehavior: IDeviceBehavior;
DisplayMetrics: TDeviceDisplayMetrics;
SaveService : IFMXSaveStateService;
{$ENDIF}
InfoService : IFMXSystemInformationService;
FontService : IFMXSystemFontService;
LoggingService : IFMXLoggingService;
ListingService : IFMXListingService;
g : TCustomGestureCollectionItem;
t : Integer;
tmpControl : TControl;
tmpPrinter : String;
{$IFDEF ANDROID}
{$IF FireMonkeyVersion>=21}
tmpTheme : String;
{$ENDIF}
{$ENDIF}
{$IFDEF IOS}
tmpDevice : UIDevice;
{$ENDIF}
tmpCapture : TCaptureDeviceManager;
tmpVideo : TVideoCaptureDevice;
{$IFDEF HASPRINTER}
tmpHasPrinter : Boolean;
{$ENDIF}
begin
tmpControl:=nil;
if Assigned(Screen.ActiveForm) then
for t := 0 to Screen.ActiveForm.ChildrenCount-1 do
if Screen.ActiveForm.Children[t] is TControl then
begin
tmpControl:=TControl(Screen.ActiveForm.Children[t]);
break;
end;
{$IF Declared(FireMonkeyVersion)}
Add('FireMonkey Version',FireMonkeyVersion);
{$ENDIF}
Add;
Add('Title',Application.Title);
Add('DefaultTitle',Application.DefaultTitle);
Add('TeeChart Version',TeeMsg_Version);
{$IFDEF D22}
Add('Action Update Delay',Application.ActionUpdateDelay);
{$ENDIF}
{$IFDEF D22}
Add('Analytics',Application.AnalyticsManager.TrackingEnabled);
Add('Track Activity',Application.TrackActivity);
{$ENDIF}
{$IFDEF ANDROID}
AddHeader('Android');
{$IF FireMonkeyVersion<21}
Add('GetApplicationTitle',GetApplicationTitle);
Add('GetPackagePath',GetPackagePath);
{$ENDIF}
{$IF FireMonkeyVersion>=21}
if GetNativeTheme=TJAlertDialog.JavaClass.THEME_HOLO_LIGHT then
tmpTheme:='Holo Light'
else
if GetNativeTheme=TJAlertDialog.JavaClass.THEME_HOLO_DARK then
tmpTheme:='Holo Dark'
else
tmpTheme:=IntToStr(GetNativeTheme);
Add('GetNativeTheme',tmpTheme);
{$ENDIF}
{$IFNDEF D28}
Add('Is Gingerbread Device',IsGingerbreadDevice);
{$ENDIF}
AddHeader('Android Device');
Add('Radio Version',JStringToString(TJBuild.JavaClass.getRadioVersion));
Add('Board',JStringToString(TJBuild.JavaClass.BOARD));
Add('Bootloader',JStringToString(TJBuild.JavaClass.BOOTLOADER));
Add('Brand',JStringToString(TJBuild.JavaClass.BRAND));
Add('CPU_ABI',JStringToString(TJBuild.JavaClass.CPU_ABI));
Add('CPU_ABI2',JStringToString(TJBuild.JavaClass.CPU_ABI2));
Add('Device',JStringToString(TJBuild.JavaClass.DEVICE));
Add('Display',JStringToString(TJBuild.JavaClass.DISPLAY));
Add('Fingerprint',JStringToString(TJBuild.JavaClass.FINGERPRINT));
Add('Hardware',JStringToString(TJBuild.JavaClass.HARDWARE));
Add('Host',JStringToString(TJBuild.JavaClass.HOST));
Add('ID',JStringToString(TJBuild.JavaClass.ID));
Add('Manufacturer',JStringToString(TJBuild.JavaClass.MANUFACTURER));
Add('Model',JStringToString(TJBuild.JavaClass.MODEL));
Add('Product',JStringToString(TJBuild.JavaClass.PRODUCT));
Add('Radio',JStringToString(TJBuild.JavaClass.RADIO));
Add('Serial',JStringToString(TJBuild.JavaClass.SERIAL));
Add('Tags',JStringToString(TJBuild.JavaClass.TAGS));
Add('Time',TJBuild.JavaClass.TIME);
Add('Type',JStringToString(TJBuild.JavaClass.&TYPE));
Add('Unknown',JStringToString(TJBuild.JavaClass.UNKNOWN));
Add('User',JStringToString(TJBuild.JavaClass.USER));
Add;
{$ENDIF}
{$IFDEF IOS}
AddHeader('iOS');
Add('IsPhone',IsPhone);
Add('IsPad',IsPad);
tmpDevice:=TUIDevice.Wrap(TUIDevice.OCClass.currentDevice);
AddHeader('iOS Device');
Add('Model',UTF8ToString(tmpDevice.model.UTF8String));
Add('Name',UTF8ToString(tmpDevice.name.UTF8String));
Add('Battery Level',tmpDevice.batteryLevel);
Add('Multitasking Supported',tmpDevice.isMultitaskingSupported);
Add('Proximity Monitoring Enabled',tmpDevice.isProximityMonitoringEnabled);
Add('System Name',UTF8ToString(tmpDevice.systemName.UTF8String));
Add('System Version',UTF8ToString(tmpDevice.systemVersion.UTF8String));
Add('Unique Identifier',UTF8ToString(tmpDevice.uniqueIdentifier.UTF8String));
Add('Identifier for Vendor',UTF8ToString(tmpDevice.identifierForVendor.UUIDString.UTF8String));
Add;
{$ENDIF}
{$IFDEF MACOSX}
AddHeader('Mac OSX');
Add('GetTimeZone',GetTimeZone);
Add;
{$ENDIF}
// (Android & iOS only)
if TPlatformServices.Current.SupportsPlatformService(IFMXDeviceService, IInterface(DeviceSrv)) then
begin
AddHeader('IFMXDeviceService');
{$IF FireMonkeyVersion>20}
Add('Has Touchscreen',(TDeviceFeature.HasTouchScreen in DeviceSrv.GetFeatures));
{$IF CompilerVersion>=28}
Add('Device Class',DeviceClassToStr(DeviceSrv.GetDeviceClass));
{$ELSE}
case DeviceSrv.GetKind of
TDeviceKind.Desktop: Add('Kind','Desktop Device');
TDeviceKind.iPhone: Add('Kind','iPhone Device');
else
Add('iPad Device');
end;
{$ENDIF}
{$ENDIF}
Add('Model',DeviceSrv.GetModel);
if TDeviceFeature.HasTouchScreen in DeviceSrv.GetFeatures then
Add('Has TouchScren',True);
Add;
end;
{$IF FireMonkeyVersion>20}
if Assigned(tmpControl) and
TBehaviorServices.Current.SupportsBehaviorService(IDeviceBehavior,DeviceBehavior, tmpControl) then
begin
AddHeader('IDeviceBehavior');
DisplayMetrics:=DeviceBehavior.GetDisplayMetrics(tmpControl);