Стартовый пул
This commit is contained in:
111
ANB ST CP/Demo/JSON/JSONFontDemo/data/MainForm.lfm
Normal file
111
ANB ST CP/Demo/JSON/JSONFontDemo/data/MainForm.lfm
Normal file
@@ -0,0 +1,111 @@
|
||||
object MainFrm: TMainFrm
|
||||
Left = 603
|
||||
Height = 297
|
||||
Top = 302
|
||||
Width = 559
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'JSON Font Demo'
|
||||
ClientHeight = 297
|
||||
ClientWidth = 559
|
||||
Font.CharSet = RUSSIAN_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -15
|
||||
Font.Name = 'Times New Roman'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.6.4.0'
|
||||
object JSONFileNameEd: TFileNameEdit
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 32
|
||||
Width = 528
|
||||
Filter = 'JSON File (*.json)|*.json'
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
Flat = True
|
||||
FocusOnButtonClick = True
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
end
|
||||
object JSONFileNameEdLbl: TLabel
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 72
|
||||
Caption = '&Имя файла:'
|
||||
ParentColor = False
|
||||
end
|
||||
object KeyEdt: TLabeledEdit
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 88
|
||||
Width = 528
|
||||
EditLabel.AnchorSideLeft.Control = KeyEdt
|
||||
EditLabel.AnchorSideRight.Control = KeyEdt
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = KeyEdt
|
||||
EditLabel.Left = 16
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 68
|
||||
EditLabel.Width = 528
|
||||
EditLabel.Caption = '&Ключ:'
|
||||
EditLabel.ParentColor = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object ExitBtn: TButton
|
||||
Left = 432
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 112
|
||||
Caption = 'В&ыход'
|
||||
Default = True
|
||||
OnClick = ExitBtnClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object WriteBtn: TButton
|
||||
Left = 296
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 131
|
||||
Caption = '&Записать'
|
||||
OnClick = WriteBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object FontDemoLbl: TLabel
|
||||
Left = 16
|
||||
Height = 56
|
||||
Top = 136
|
||||
Width = 528
|
||||
AutoSize = False
|
||||
Caption = 'Это пример шрифта'
|
||||
ParentColor = False
|
||||
end
|
||||
object ReadBtn: TButton
|
||||
Left = 160
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 131
|
||||
Caption = '&Прочитать'
|
||||
OnClick = ReadBtnClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object SelectFontBtn: TButton
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 203
|
||||
Width = 528
|
||||
Caption = 'В&ыбрать шрифт'
|
||||
OnClick = SelectFontBtnClick
|
||||
TabOrder = 5
|
||||
end
|
||||
object FontDialog: TFontDialog
|
||||
MinFontSize = 0
|
||||
MaxFontSize = 0
|
||||
left = 440
|
||||
top = 8
|
||||
end
|
||||
end
|
69
ANB ST CP/Demo/JSON/JSONFontDemo/data/MainForm.pas
Normal file
69
ANB ST CP/Demo/JSON/JSONFontDemo/data/MainForm.pas
Normal file
@@ -0,0 +1,69 @@
|
||||
unit MainForm;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, EditBtn, windows, SimplyJSON;
|
||||
type
|
||||
{ TMainFrm }
|
||||
TMainFrm = class(TForm)
|
||||
FontDialog: TFontDialog;
|
||||
SelectFontBtn: TButton;
|
||||
FontDemoLbl: TLabel;
|
||||
WriteBtn: TButton;
|
||||
ExitBtn: TButton;
|
||||
JSONFileNameEd: TFileNameEdit;
|
||||
JSONFileNameEdLbl: TLabel;
|
||||
KeyEdt: TLabeledEdit;
|
||||
ReadBtn: TButton;
|
||||
procedure ExitBtnClick(Sender: TObject);
|
||||
procedure ReadBtnClick(Sender: TObject);
|
||||
procedure SelectFontBtnClick(Sender: TObject);
|
||||
procedure WriteBtnClick(Sender: TObject);
|
||||
private
|
||||
public
|
||||
function CheckReqs: Boolean;
|
||||
end;
|
||||
var
|
||||
MainFrm: TMainFrm;
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
{ TMainFrm }
|
||||
function TMainFrm.CheckReqs: Boolean;
|
||||
begin
|
||||
Result:= True;
|
||||
if Trim(JSONFileNameEd.Text) = '' then
|
||||
begin
|
||||
Application.MessageBox(PChar('Поле "Имя файла" не заполнено!'), PChar('Ошибка!'), MB_ICONERROR);
|
||||
Result:= False;
|
||||
end;
|
||||
if Trim(KeyEdt.Text) = '' then
|
||||
begin
|
||||
Application.MessageBox(PChar('Поле "Ключ" не заполнено!'), PChar('Ошибка!'), MB_ICONERROR);
|
||||
Result:= False;
|
||||
end;
|
||||
end;
|
||||
procedure TMainFrm.ExitBtnClick(Sender: TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
end;
|
||||
procedure TMainFrm.ReadBtnClick(Sender: TObject);
|
||||
begin
|
||||
if not CheckReqs then
|
||||
Exit;
|
||||
FontDemoLbl.Font:= JSReadFont(KeyEdt.Text, FontDemoLbl.Font, JSONFileNameEd.Text);
|
||||
Application.MessageBox(PChar('Шрифт загружен из файла!'), PChar('Информация'), MB_ICONASTERISK);
|
||||
end;
|
||||
procedure TMainFrm.SelectFontBtnClick(Sender: TObject);
|
||||
begin
|
||||
FontDialog.Font:= FontDemoLbl.Font;
|
||||
if FontDialog.Execute then
|
||||
FontDemoLbl.Font:= FontDialog.Font;
|
||||
end;
|
||||
procedure TMainFrm.WriteBtnClick(Sender: TObject);
|
||||
begin
|
||||
if not CheckReqs then
|
||||
Exit;
|
||||
JSWriteFont(KeyEdt.Text, FontDemoLbl.Font, JSONFileNameEd.Text);
|
||||
Application.MessageBox(PChar('Шрифт записан в файл!'), PChar('Информация'), MB_ICONASTERISK);
|
||||
end;
|
||||
end.
|
BIN
ANB ST CP/Demo/JSON/JSONFontDemo/jsonfontdemo.ico
Normal file
BIN
ANB ST CP/Demo/JSON/JSONFontDemo/jsonfontdemo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
114
ANB ST CP/Demo/JSON/JSONFontDemo/jsonfontdemo.lpi
Normal file
114
ANB ST CP/Demo/JSON/JSONFontDemo/jsonfontdemo.lpi
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="JSON Font Demo"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<MinorVersionNr Value="5"/>
|
||||
<RevisionNr Value="1"/>
|
||||
<BuildNr Value="5"/>
|
||||
<Language Value="0419"/>
|
||||
<StringTable CompanyName="Alexander Babaev" FileDescription="BGPlus Backups Creator" InternalName="BC" LegalCopyright="Alexander Babaev" LegalTrademarks="Alexander Babaev" OriginalFilename="BGPlus BC" ProductName="BGPlus Manager" ProductVersion="0.5"/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Win32" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="ANBSTCP"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LazControls"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="jsonfontdemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="data\MainForm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="MainFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="jsonfontdemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="data"/>
|
||||
<UnitOutputDirectory Value="data\lib\Win32"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<TargetCPU Value="i386"/>
|
||||
<TargetOS Value="win32"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="4"/>
|
||||
</Optimizations>
|
||||
<SmallerCode Value="True"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<StripSymbols Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
11
ANB ST CP/Demo/JSON/JSONFontDemo/jsonfontdemo.lpr
Normal file
11
ANB ST CP/Demo/JSON/JSONFontDemo/jsonfontdemo.lpr
Normal file
@@ -0,0 +1,11 @@
|
||||
program jsonfontdemo;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
uses Interfaces, Forms, lazcontrols, MainForm;
|
||||
{$R *.res}
|
||||
begin
|
||||
Application.Title:= 'JSON Font Demo';
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainFrm, MainFrm);
|
||||
Application.Run;
|
||||
end.
|
104
ANB ST CP/Demo/JSON/JSONReader/data/MainForm.lfm
Normal file
104
ANB ST CP/Demo/JSON/JSONReader/data/MainForm.lfm
Normal file
@@ -0,0 +1,104 @@
|
||||
object MainFrm: TMainFrm
|
||||
Left = 603
|
||||
Height = 221
|
||||
Top = 302
|
||||
Width = 559
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'JSON Reader'
|
||||
ClientHeight = 221
|
||||
ClientWidth = 559
|
||||
Font.CharSet = RUSSIAN_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -15
|
||||
Font.Name = 'Times New Roman'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.6.0.1'
|
||||
object JSONFileNameEd: TFileNameEdit
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 32
|
||||
Width = 528
|
||||
Filter = 'JSON File (*.json)|*.json'
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
Flat = True
|
||||
FocusOnButtonClick = True
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
end
|
||||
object JSONFileNameEdLbl: TLabel
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 72
|
||||
Caption = '&Имя файла:'
|
||||
ParentColor = False
|
||||
end
|
||||
object KeyEdt: TLabeledEdit
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 88
|
||||
Width = 528
|
||||
EditLabel.AnchorSideLeft.Control = KeyEdt
|
||||
EditLabel.AnchorSideRight.Control = KeyEdt
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = KeyEdt
|
||||
EditLabel.Left = 16
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 68
|
||||
EditLabel.Width = 528
|
||||
EditLabel.Caption = '&Ключ:'
|
||||
EditLabel.ParentColor = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object RecTypeEd: TRadioGroup
|
||||
Left = 16
|
||||
Height = 48
|
||||
Top = 128
|
||||
Width = 528
|
||||
AutoFill = True
|
||||
Caption = '&Тип:'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 26
|
||||
ClientWidth = 524
|
||||
Columns = 3
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Строка'
|
||||
'Число'
|
||||
'Правда/Ложь'
|
||||
)
|
||||
TabOrder = 2
|
||||
end
|
||||
object ExitBtn: TButton
|
||||
Left = 432
|
||||
Height = 25
|
||||
Top = 184
|
||||
Width = 112
|
||||
Caption = 'В&ыход'
|
||||
Default = True
|
||||
OnClick = ExitBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object ReadBtn: TButton
|
||||
Left = 296
|
||||
Height = 25
|
||||
Top = 184
|
||||
Width = 131
|
||||
Caption = '&Прочитать'
|
||||
OnClick = ReadBtnClick
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
64
ANB ST CP/Demo/JSON/JSONReader/data/MainForm.pas
Normal file
64
ANB ST CP/Demo/JSON/JSONReader/data/MainForm.pas
Normal file
@@ -0,0 +1,64 @@
|
||||
unit MainForm;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, EditBtn, ComCtrls, Spin,
|
||||
windows, SimplyJSON;
|
||||
type
|
||||
{ TMainFrm }
|
||||
TMainFrm = class(TForm)
|
||||
ReadBtn: TButton;
|
||||
ExitBtn: TButton;
|
||||
JSONFileNameEd: TFileNameEdit;
|
||||
JSONFileNameEdLbl: TLabel;
|
||||
KeyEdt: TLabeledEdit;
|
||||
RecTypeEd: TRadioGroup;
|
||||
procedure ExitBtnClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ReadBtnClick(Sender: TObject);
|
||||
private
|
||||
public
|
||||
end;
|
||||
var
|
||||
MainFrm: TMainFrm;
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
{ TMainFrm }
|
||||
procedure TMainFrm.ExitBtnClick(Sender: TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
end;
|
||||
procedure TMainFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
RecTypeEd.ItemIndex:= 0;
|
||||
end;
|
||||
procedure TMainFrm.ReadBtnClick(Sender: TObject);
|
||||
var STitle, SMsg: String;
|
||||
begin
|
||||
if Trim(JSONFileNameEd.Text) = '' then
|
||||
begin
|
||||
Application.MessageBox(PChar('Поле "Имя файла" не заполнено!'), PChar('Ошибка!'), MB_ICONERROR);
|
||||
Abort;
|
||||
end;
|
||||
if Trim(KeyEdt.Text) = '' then
|
||||
begin
|
||||
Application.MessageBox(PChar('Поле "Ключ" не заполнено!'), PChar('Ошибка!'), MB_ICONERROR);
|
||||
Abort;
|
||||
end;
|
||||
case RecTypeEd.ItemIndex of
|
||||
0: begin
|
||||
STitle:= 'Строка';
|
||||
SMsg:= JSReadString(KeyEdt.Text, '???', JSONFileNameEd.Text);
|
||||
end;
|
||||
1: begin
|
||||
STitle:= 'Число';
|
||||
SMsg:= IntToStr(JSReadInteger(KeyEdt.Text, 0, JSONFileNameEd.Text));
|
||||
end;
|
||||
2: begin
|
||||
STitle:= 'Правда/Ложь';
|
||||
SMsg:= BoolToStr(JSReadBoolean(KeyEdt.Text, False, JSONFileNameEd.Text), 'Правда', 'Ложь');
|
||||
end;
|
||||
end;
|
||||
Application.MessageBox(PChar(SMsg), PChar(STitle), MB_ICONASTERISK);
|
||||
end;
|
||||
end.
|
BIN
ANB ST CP/Demo/JSON/JSONReader/jsonreader.ico
Normal file
BIN
ANB ST CP/Demo/JSON/JSONReader/jsonreader.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
114
ANB ST CP/Demo/JSON/JSONReader/jsonreader.lpi
Normal file
114
ANB ST CP/Demo/JSON/JSONReader/jsonreader.lpi
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="JSONReader Demo"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<MinorVersionNr Value="5"/>
|
||||
<RevisionNr Value="1"/>
|
||||
<BuildNr Value="5"/>
|
||||
<Language Value="0419"/>
|
||||
<StringTable CompanyName="Alexander Babaev" FileDescription="BGPlus Backups Creator" InternalName="BC" LegalCopyright="Alexander Babaev" LegalTrademarks="Alexander Babaev" OriginalFilename="BGPlus BC" ProductName="BGPlus Manager" ProductVersion="0.5"/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Win32" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="ANBSTCP"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LazControls"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="jsonreader.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="data\MainForm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="MainFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="jsonreader"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="data"/>
|
||||
<UnitOutputDirectory Value="data\lib\Win32"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<TargetCPU Value="i386"/>
|
||||
<TargetOS Value="win32"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="4"/>
|
||||
</Optimizations>
|
||||
<SmallerCode Value="True"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<StripSymbols Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
11
ANB ST CP/Demo/JSON/JSONReader/jsonreader.lpr
Normal file
11
ANB ST CP/Demo/JSON/JSONReader/jsonreader.lpr
Normal file
@@ -0,0 +1,11 @@
|
||||
program jsonreader;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
uses Interfaces, Forms, lazcontrols, MainForm;
|
||||
{$R *.res}
|
||||
begin
|
||||
Application.Title:='JSONReader Demo';
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainFrm, MainFrm);
|
||||
Application.Run;
|
||||
end.
|
170
ANB ST CP/Demo/JSON/JSONWriter/data/MainForm.lfm
Normal file
170
ANB ST CP/Demo/JSON/JSONWriter/data/MainForm.lfm
Normal file
@@ -0,0 +1,170 @@
|
||||
object MainFrm: TMainFrm
|
||||
Left = 603
|
||||
Height = 297
|
||||
Top = 302
|
||||
Width = 559
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'JSON Writer'
|
||||
ClientHeight = 297
|
||||
ClientWidth = 559
|
||||
Font.CharSet = RUSSIAN_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -15
|
||||
Font.Name = 'Times New Roman'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.6.0.1'
|
||||
object JSONFileNameEd: TFileNameEdit
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 32
|
||||
Width = 528
|
||||
Filter = 'JSON File (*.json)|*.json'
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
Flat = True
|
||||
FocusOnButtonClick = True
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
end
|
||||
object JSONFileNameEdLbl: TLabel
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 72
|
||||
Caption = '&Имя файла:'
|
||||
ParentColor = False
|
||||
end
|
||||
object KeyEdt: TLabeledEdit
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 88
|
||||
Width = 528
|
||||
EditLabel.AnchorSideLeft.Control = KeyEdt
|
||||
EditLabel.AnchorSideRight.Control = KeyEdt
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = KeyEdt
|
||||
EditLabel.Left = 16
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 68
|
||||
EditLabel.Width = 528
|
||||
EditLabel.Caption = '&Ключ:'
|
||||
EditLabel.ParentColor = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object RecTypeEd: TRadioGroup
|
||||
Left = 16
|
||||
Height = 48
|
||||
Top = 128
|
||||
Width = 528
|
||||
AutoFill = True
|
||||
Caption = '&Тип:'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 26
|
||||
ClientWidth = 524
|
||||
Columns = 3
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Строка'
|
||||
'Число'
|
||||
'Правда/Ложь'
|
||||
)
|
||||
OnSelectionChanged = RecTypeEdSelectionChanged
|
||||
TabOrder = 2
|
||||
end
|
||||
object ValuePages: TPageControl
|
||||
Left = 16
|
||||
Height = 48
|
||||
Top = 200
|
||||
Width = 528
|
||||
ActivePage = StringSht
|
||||
ShowTabs = False
|
||||
TabIndex = 0
|
||||
TabOrder = 3
|
||||
object StringSht: TTabSheet
|
||||
Caption = 'StringSht'
|
||||
ClientHeight = 40
|
||||
ClientWidth = 520
|
||||
object sValueEd: TEdit
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 504
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object IntegerSht: TTabSheet
|
||||
Caption = 'IntegerSht'
|
||||
ClientHeight = 40
|
||||
ClientWidth = 520
|
||||
object iValueEd: TSpinEdit
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 498
|
||||
Alignment = taRightJustify
|
||||
MaxValue = 2147483647
|
||||
MinValue = -2147483648
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object BooleanSht: TTabSheet
|
||||
Caption = 'BooleanSht'
|
||||
ClientHeight = 40
|
||||
ClientWidth = 520
|
||||
object bValueEd: TComboBox
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 496
|
||||
ItemHeight = 17
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Правда'
|
||||
'Ложь'
|
||||
)
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
Text = 'Правда'
|
||||
end
|
||||
end
|
||||
end
|
||||
object ValueEdLbl: TLabel
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 183
|
||||
Width = 115
|
||||
Caption = '&Введите значение:'
|
||||
ParentColor = False
|
||||
end
|
||||
object ExitBtn: TButton
|
||||
Left = 432
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 112
|
||||
Caption = 'В&ыход'
|
||||
Default = True
|
||||
OnClick = ExitBtnClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object WriteBtn: TButton
|
||||
Left = 296
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 131
|
||||
Caption = '&Записать'
|
||||
OnClick = WriteBtnClick
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
72
ANB ST CP/Demo/JSON/JSONWriter/data/MainForm.pas
Normal file
72
ANB ST CP/Demo/JSON/JSONWriter/data/MainForm.pas
Normal file
@@ -0,0 +1,72 @@
|
||||
unit MainForm;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, EditBtn, ComCtrls, Spin,
|
||||
windows, SimplyJSON;
|
||||
type
|
||||
{ TMainFrm }
|
||||
TMainFrm = class(TForm)
|
||||
WriteBtn: TButton;
|
||||
ExitBtn: TButton;
|
||||
bValueEd: TComboBox;
|
||||
iValueEd: TSpinEdit;
|
||||
sValueEd: TEdit;
|
||||
JSONFileNameEd: TFileNameEdit;
|
||||
JSONFileNameEdLbl: TLabel;
|
||||
KeyEdt: TLabeledEdit;
|
||||
BooleanSht: TTabSheet;
|
||||
ValueEdLbl: TLabel;
|
||||
StringSht: TTabSheet;
|
||||
IntegerSht: TTabSheet;
|
||||
ValuePages: TPageControl;
|
||||
RecTypeEd: TRadioGroup;
|
||||
procedure ExitBtnClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure RecTypeEdSelectionChanged(Sender: TObject);
|
||||
procedure WriteBtnClick(Sender: TObject);
|
||||
private
|
||||
public
|
||||
end;
|
||||
var
|
||||
MainFrm: TMainFrm;
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
{ TMainFrm }
|
||||
procedure TMainFrm.ExitBtnClick(Sender: TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
end;
|
||||
procedure TMainFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
RecTypeEd.ItemIndex:= 0;
|
||||
ValuePages.ActivePage:= StringSht;
|
||||
end;
|
||||
procedure TMainFrm.RecTypeEdSelectionChanged(Sender: TObject);
|
||||
begin
|
||||
case RecTypeEd.ItemIndex of
|
||||
0: ValuePages.ActivePage:= StringSht;
|
||||
1: ValuePages.ActivePage:= IntegerSht;
|
||||
2: ValuePages.ActivePage:= BooleanSht;
|
||||
end;
|
||||
end;
|
||||
procedure TMainFrm.WriteBtnClick(Sender: TObject);
|
||||
begin
|
||||
if Trim(JSONFileNameEd.Text) = '' then
|
||||
begin
|
||||
Application.MessageBox(PChar('Поле "Имя файла" не заполнено!'), PChar('Ошибка!'), MB_ICONERROR);
|
||||
Abort;
|
||||
end;
|
||||
if Trim(KeyEdt.Text) = '' then
|
||||
begin
|
||||
Application.MessageBox(PChar('Поле "Ключ" не заполнено!'), PChar('Ошибка!'), MB_ICONERROR);
|
||||
Abort;
|
||||
end;
|
||||
case RecTypeEd.ItemIndex of
|
||||
0: JSWriteString(KeyEdt.Text, sValueEd.Text, JSONFileNameEd.Text);
|
||||
1: JSWriteInteger(KeyEdt.Text, iValueEd.Value, JSONFileNameEd.Text);
|
||||
2: JSWriteBoolean(KeyEdt.Text, (bValueEd.ItemIndex = 0), JSONFileNameEd.Text);
|
||||
end;
|
||||
Application.MessageBox(PChar('Выполнено!'), PChar('Информация'), MB_ICONASTERISK);
|
||||
end;
|
||||
end.
|
BIN
ANB ST CP/Demo/JSON/JSONWriter/jsonwriter.ico
Normal file
BIN
ANB ST CP/Demo/JSON/JSONWriter/jsonwriter.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
114
ANB ST CP/Demo/JSON/JSONWriter/jsonwriter.lpi
Normal file
114
ANB ST CP/Demo/JSON/JSONWriter/jsonwriter.lpi
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="JSONWriter Demo"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<MinorVersionNr Value="5"/>
|
||||
<RevisionNr Value="1"/>
|
||||
<BuildNr Value="5"/>
|
||||
<Language Value="0419"/>
|
||||
<StringTable CompanyName="Alexander Babaev" FileDescription="BGPlus Backups Creator" InternalName="BC" LegalCopyright="Alexander Babaev" LegalTrademarks="Alexander Babaev" OriginalFilename="BGPlus BC" ProductName="BGPlus Manager" ProductVersion="0.5"/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Win32" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="ANBSTCP"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LazControls"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="jsonwriter.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="data\MainForm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="MainFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="jsonwriter"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="data"/>
|
||||
<UnitOutputDirectory Value="data\lib\Win32"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<TargetCPU Value="i386"/>
|
||||
<TargetOS Value="win32"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="4"/>
|
||||
</Optimizations>
|
||||
<SmallerCode Value="True"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<StripSymbols Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
11
ANB ST CP/Demo/JSON/JSONWriter/jsonwriter.lpr
Normal file
11
ANB ST CP/Demo/JSON/JSONWriter/jsonwriter.lpr
Normal file
@@ -0,0 +1,11 @@
|
||||
program jsonwriter;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
uses Interfaces, Forms, lazcontrols, MainForm;
|
||||
{$R *.res}
|
||||
begin
|
||||
Application.Title:= 'JSONWriter Demo';
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainFrm, MainFrm);
|
||||
Application.Run;
|
||||
end.
|
162
ANB ST CP/Demo/ParamsMngr/Demo.lpi
Normal file
162
ANB ST CP/Demo/ParamsMngr/Demo.lpi
Normal file
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="Demo"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="2">
|
||||
<Item1 Name="Win32" Default="True"/>
|
||||
<Item2 Name="Win64">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="Win64\Demo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="data;$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="data"/>
|
||||
<UnitOutputDirectory Value="data\lib\Win64\"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<TargetCPU Value="x86_64"/>
|
||||
<TargetOS Value="win64"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="3"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="False"/>
|
||||
<StripSymbols Value="True"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item2>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="ANBSTCP"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="Demo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="data\DemoMainForm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="DemoMainFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="DemoMainForm"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="Win32\Demo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="data;$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="data"/>
|
||||
<UnitOutputDirectory Value="data\lib\Win32\"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<TargetCPU Value="i386"/>
|
||||
<TargetOS Value="win32"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="3"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="False"/>
|
||||
<StripSymbols Value="True"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
12
ANB ST CP/Demo/ParamsMngr/Demo.lpr
Normal file
12
ANB ST CP/Demo/ParamsMngr/Demo.lpr
Normal file
@@ -0,0 +1,12 @@
|
||||
program Demo;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
uses Forms, Interfaces,
|
||||
DemoMainForm in 'data\DemoMainForm.pas' {DemoMainFrm};
|
||||
{$R *.res}
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.MainFormOnTaskbar := True;
|
||||
Application.CreateForm(TDemoMainFrm, DemoMainFrm);
|
||||
Application.Run;
|
||||
end.
|
63
ANB ST CP/Demo/ParamsMngr/data/DemoMainForm.lfm
Normal file
63
ANB ST CP/Demo/ParamsMngr/data/DemoMainForm.lfm
Normal file
@@ -0,0 +1,63 @@
|
||||
object DemoMainFrm: TDemoMainFrm
|
||||
Left = 642
|
||||
Height = 172
|
||||
Top = 381
|
||||
Width = 326
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'DEMO -- ParamsMngr'
|
||||
ClientHeight = 172
|
||||
ClientWidth = 326
|
||||
Color = clBtnFace
|
||||
Font.CharSet = RUSSIAN_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -15
|
||||
Font.Name = 'Times New Roman'
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.2.2.0'
|
||||
object TestSParam: TButton
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 16
|
||||
Width = 310
|
||||
Caption = '/s param test'
|
||||
OnClick = TestSParamClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object TestTestParam: TButton
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 47
|
||||
Width = 310
|
||||
Caption = '/test param test'
|
||||
OnClick = TestTestParamClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object TestVParamValue: TButton
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 78
|
||||
Width = 310
|
||||
Caption = '/v param value test'
|
||||
OnClick = TestVParamValueClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object TestMSGParamValue: TButton
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 109
|
||||
Width = 310
|
||||
Caption = '/msg param value test'
|
||||
OnClick = TestMSGParamValueClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object ExitBtn: TButton
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 140
|
||||
Width = 310
|
||||
Caption = '&Exit'
|
||||
OnClick = ExitBtnClick
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
56
ANB ST CP/Demo/ParamsMngr/data/DemoMainForm.pas
Normal file
56
ANB ST CP/Demo/ParamsMngr/data/DemoMainForm.pas
Normal file
@@ -0,0 +1,56 @@
|
||||
unit DemoMainForm;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes,
|
||||
Graphics, Controls, Forms, Dialogs, StdCtrls, ParamsMngr;
|
||||
type
|
||||
TDemoMainFrm = class(TForm)
|
||||
TestSParam: TButton;
|
||||
TestTestParam: TButton;
|
||||
TestVParamValue: TButton;
|
||||
TestMSGParamValue: TButton;
|
||||
ExitBtn: TButton;
|
||||
procedure ExitBtnClick(Sender: TObject);
|
||||
procedure TestSParamClick(Sender: TObject);
|
||||
procedure TestTestParamClick(Sender: TObject);
|
||||
procedure TestVParamValueClick(Sender: TObject);
|
||||
procedure TestMSGParamValueClick(Sender: TObject);
|
||||
private
|
||||
public
|
||||
end;
|
||||
var
|
||||
DemoMainFrm: TDemoMainFrm;
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
procedure ShowDLG (const ATitle, AMessage: string);
|
||||
begin
|
||||
Application.MessageBox(pchar(AMessage), pchar(ATitle), MB_ICONASTERISK);
|
||||
end;
|
||||
procedure TDemoMainFrm.ExitBtnClick(Sender: TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
end;
|
||||
procedure TDemoMainFrm.TestMSGParamValueClick(Sender: TObject);
|
||||
begin
|
||||
if HasParam(StartParams, 'msg') then
|
||||
ShowDLG(TestMSGParamValue.Caption, GetParamValue(StartParams, 'msg'))
|
||||
else
|
||||
ShowDLG(TestMSGParamValue.Caption, 'Param "/msg" not founded!');
|
||||
end;
|
||||
procedure TDemoMainFrm.TestSParamClick(Sender: TObject);
|
||||
begin
|
||||
ShowDLG(TestSParam.Caption, BoolToStr(HasParam(StartParams, 's'), true));
|
||||
end;
|
||||
procedure TDemoMainFrm.TestTestParamClick(Sender: TObject);
|
||||
begin
|
||||
ShowDLG(TestTestParam.Caption, BoolToStr(HasParam(StartParams, 'test'), true));
|
||||
end;
|
||||
procedure TDemoMainFrm.TestVParamValueClick(Sender: TObject);
|
||||
begin
|
||||
if HasParam(StartParams, 'v') then
|
||||
ShowDLG(TestVParamValue.Caption, GetParamValue(StartParams, 'v'))
|
||||
else
|
||||
ShowDLG(TestVParamValue.Caption, 'Param "/v" not founded!');
|
||||
end;
|
||||
end.
|
59
ANB ST CP/Demo/WaitDemo/sources/data/MainForm.lfm
Normal file
59
ANB ST CP/Demo/WaitDemo/sources/data/MainForm.lfm
Normal file
@@ -0,0 +1,59 @@
|
||||
object MainFrm: TMainFrm
|
||||
Left = 301
|
||||
Height = 154
|
||||
Top = 148
|
||||
Width = 397
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'Wait DEMO'
|
||||
ClientHeight = 154
|
||||
ClientWidth = 397
|
||||
Font.CharSet = RUSSIAN_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -15
|
||||
Font.Name = 'Times New Roman'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
LCLVersion = '1.6.0.4'
|
||||
object WaitingIntro: TLabel
|
||||
Left = 10
|
||||
Height = 17
|
||||
Top = 10
|
||||
Width = 377
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 10
|
||||
Caption = '&We waiting (sec):'
|
||||
ParentColor = False
|
||||
end
|
||||
object WaitingSec: TLabel
|
||||
Left = 10
|
||||
Height = 72
|
||||
Top = 37
|
||||
Width = 377
|
||||
Align = alClient
|
||||
Alignment = taCenter
|
||||
BorderSpacing.Around = 10
|
||||
Caption = '&Press "wait 5 sec"...'
|
||||
Font.CharSet = ANSI_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -15
|
||||
Font.Name = 'Old English Text MT'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
Font.Style = [fsBold]
|
||||
Layout = tlCenter
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object WaitBtn: TButton
|
||||
Left = 10
|
||||
Height = 25
|
||||
Top = 119
|
||||
Width = 377
|
||||
Align = alBottom
|
||||
BorderSpacing.Around = 10
|
||||
Caption = '&Wait 5 sec'
|
||||
OnClick = WaitBtnClick
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
41
ANB ST CP/Demo/WaitDemo/sources/data/MainForm.pas
Normal file
41
ANB ST CP/Demo/WaitDemo/sources/data/MainForm.pas
Normal file
@@ -0,0 +1,41 @@
|
||||
unit MainForm;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, VCLEx;
|
||||
type
|
||||
{ TMainFrm }
|
||||
TMainFrm = class(TForm)
|
||||
WaitBtn: TButton;
|
||||
WaitingSec: TLabel;
|
||||
WaitingIntro: TLabel;
|
||||
procedure WaitBtnClick(Sender: TObject);
|
||||
private
|
||||
public
|
||||
CurWait, OldS, NewS: Int64;
|
||||
end;
|
||||
var
|
||||
MainFrm: TMainFrm;
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
{ TMainFrm }
|
||||
procedure TMainFrm.WaitBtnClick(Sender: TObject);
|
||||
procedure OnWait;
|
||||
begin
|
||||
MainFrm.CurWait:= MainFrm.CurWait + 1;
|
||||
MainFrm.NewS:= MainFrm.CurWait div 1000;
|
||||
if MainFrm.NewS > MainFrm.OldS then
|
||||
begin
|
||||
MainFrm.WaitingSec.Caption:= IntToStr(MainFrm.NewS);
|
||||
MainFrm.OldS:= MainFrm.NewS;
|
||||
end;
|
||||
Application.ProcessMessages;
|
||||
end;
|
||||
begin
|
||||
OldS:= 0;
|
||||
CurWait:= 0;
|
||||
WaitingSec.Caption:= '0';
|
||||
WaitEx(5000, @OnWait);
|
||||
WaitingSec.Caption:= '&Stoped...';
|
||||
end;
|
||||
end.
|
BIN
ANB ST CP/Demo/WaitDemo/sources/wdemo.ico
Normal file
BIN
ANB ST CP/Demo/WaitDemo/sources/wdemo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
96
ANB ST CP/Demo/WaitDemo/sources/wdemo.lpi
Normal file
96
ANB ST CP/Demo/WaitDemo/sources/wdemo.lpi
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="Wait Demo"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="ANBSTCP"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="wdemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="data\MainForm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="MainFrm"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="..\output\wdemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="data"/>
|
||||
<UnitOutputDirectory Value="data\lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="4"/>
|
||||
</Optimizations>
|
||||
<SmallerCode Value="True"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<StripSymbols Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
12
ANB ST CP/Demo/WaitDemo/sources/wdemo.lpr
Normal file
12
ANB ST CP/Demo/WaitDemo/sources/wdemo.lpr
Normal file
@@ -0,0 +1,12 @@
|
||||
program wdemo;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
uses Interfaces, Forms, MainForm;
|
||||
{$R *.res}
|
||||
begin
|
||||
Application.Title:='Wait Demo';
|
||||
RequireDerivedFormResource:= True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainFrm, MainFrm);
|
||||
Application.Run;
|
||||
end.
|
124
ANB ST CP/anbstcp.lpk
Normal file
124
ANB ST CP/anbstcp.lpk
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Package Version="4">
|
||||
<PathDelim Value="\"/>
|
||||
<Name Value="ANBSTCP"/>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<Author Value="Александр Бабаев"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="data"/>
|
||||
<UnitOutputDirectory Value="data\lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="3"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
</CompilerOptions>
|
||||
<Description Value="ANB ST Components Pack"/>
|
||||
<License Value="ЛИЦЕНЗИОНОЕ СОГЛАШЕНИЕ С КОНЕЧНЫМ ПОЛЬЗОВАТЕЛЕМ (EULA) НА ANB ST COMPONENTS PACK.
|
||||
(Версия 1.0)
|
||||
|
||||
ОПРЕДЕЛЕНИЯ
|
||||
|
||||
ANB ST COMPONENTS PACK (или просто ASTCP) (далее "ПРОДУКТ") - программа и/или компонент программы и/или другое (игра, изображение, фильм и т.п.), на которое распространяется данное соглашение.
|
||||
КОНЕЧНЫЙ ПОЛЬЗОВАТЕЛЬ (далее "ВЫ" или "ПОЛЬЗОВАТЕЛЬ") - лицо и/или организация, которое(-ая) использует продукт, предоставляемый под этой лицензией.
|
||||
АЛЕКСАНДР БАБАЕВ (далее "ПРОИЗВОДИТЕЛЬ") - лицо и/или организация, которое(-ая) произвело продукт.
|
||||
|
||||
ОГРАНИЧЕНИЯ
|
||||
|
||||
В некоторых государствах (районах, областях, штатах) не позволяется ограничение или исключение ответственности за непредвиденный ущерб. Если ваша страна (район, область, штат) не подразумевает ограничение или исключение ответственности за непредвиденный ущерб, то данное соглашение не может применяться к вам. В этом случае откажитесь от использования продукта.
|
||||
В некоторых государствах (районах, областях, штатах) не позволяется исключение подразумеваемых гарантий. Если ваша страна (район, область, штат) не подразумевает исключение подразумеваемых гарантий, то данное соглашение не может применяться к вам. В этом случае откажитесь от использования продукта.
|
||||
|
||||
ПРЕДМЕТ СОГЛАШЕНИЯ
|
||||
|
||||
Данное соглашение заключается между Производителем продукта и Пользователем продукта. Данное соглашение определяет отношения между Производителем и Пользователем, возникающие при использовании продукта.
|
||||
|
||||
ЛИЦЕНЗИЯ
|
||||
|
||||
Продукт распространяется по принципу "AS-IS" ("КАК ЕСТЬ"). Автор не несёт НИКАКОЙ ОТВЕТСТВЕННОСТИ в случае нанесения данной программой физического, материального или любого другого вреда вам и вашему компьютеру. Вы на свой страх и риск устанавливаете продукт. Производитель и/или Распространитель не несёт(-ут) никакой ответственности за ошибки, неисправности (и т.п.), нанесённые продуктом вашему компьютеру. Вы можете использовать данную программу на своё усмотрение, а также копировать и распространять со ссылкой на автора, сайт "http://anbsoftteam.com/".
|
||||
Вам запрещается копировать, распространять продукт без ссылки на автора и указанные ранее сайты. Вам запрещается копирование и использование продукта, если устанавливаемая вами копия продукта не имеет ссылки на автора и указанные ранее сайты. Вам запрещается ипользовать компоненты продукта в других программах без письменного соглашения Производителя, удалять или исправлять в продукте любые знаки о праве собственности и/или авторском праве на продукт.
|
||||
ЕСЛИ ВЫ ЗАГРУЖАЕТЕ, КОПИРУЕТЕ ПРОДУКТ ИЛИ ИСПОЛЬЗУЕТЕ ЕГО КАКИМ-ЛИБО ДРУГИМ СПОСОБОМ, ЭТИМ ВЫ ПОДТВЕРЖДАЕТЕ СВОЕ СОГЛАСИЕ СОБЛЮДАТЬ УСЛОВИЯ ДАННОГО
|
||||
ЛИЦЕНЗИОННОГО СОГЛАШЕНИЯ С КОНЕЧНЫМ ПОЛЬЗОВАТЕЛЕМ. ЕСЛИ ВЫ НЕ СОГЛАСНЫ, НЕ УСТАНАВЛИВАЙТЕ, НЕ КОПИРУЙТЕ И НЕ ИСПОЛЬЗУЙТЕ ПРОДУКТ.
|
||||
|
||||
АВТОРСКОЕ ПРАВО
|
||||
|
||||
Авторское право на все копии продукта принадлежат Производителю и частично Распространителю и защищено законодательством РФ и ряда других стран.
|
||||
|
||||
ОГРАНИЧЕННАЯ ГАРАНТИЯ И ПРАВОВАЯ ОГОВОРКА
|
||||
|
||||
Вам не даётся никаких гарантий. Все ваши возможные требования, притязания и претензии (в том числе и по качеству) будут НЕПРИЗНАННЫ.
|
||||
|
||||
ОГРАНИЧЕНИЕ ОТВЕТСТВЕННОСТИ
|
||||
|
||||
Вам не даётся никаких обязательств. Все ваши возможные требования будут НЕПРИЗНАНЫ.
|
||||
|
||||
СПАСИБО, ЧТО ИСПОЛЬЗУЕТЕ "ANB ST COMPONENTS PACK"!"/>
|
||||
<Version Major="1" Minor="8" Release="25" Build="70"/>
|
||||
<Files Count="10">
|
||||
<Item1>
|
||||
<Filename Value="data\ANBFormatString.pas"/>
|
||||
<UnitName Value="ANBFormatString"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="data\ParamsMngr.pas"/>
|
||||
<UnitName Value="ParamsMngr"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Filename Value="data\SimplyINI.pas"/>
|
||||
<UnitName Value="SimplyINI"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Filename Value="data\VCLEx.pas"/>
|
||||
<UnitName Value="VCLEx"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Filename Value="data\ANBInputBox.pas"/>
|
||||
<UnitName Value="ANBInputBox"/>
|
||||
</Item5>
|
||||
<Item6>
|
||||
<Filename Value="data\VersionControl.pas"/>
|
||||
<UnitName Value="VersionControl"/>
|
||||
</Item6>
|
||||
<Item7>
|
||||
<Filename Value="data\SimplyJSON.pas"/>
|
||||
<UnitName Value="SimplyJSON"/>
|
||||
</Item7>
|
||||
<Item8>
|
||||
<Filename Value="data\FileUtilsEx.pas"/>
|
||||
<UnitName Value="FileUtilsEx"/>
|
||||
</Item8>
|
||||
<Item9>
|
||||
<Filename Value="data\GraphicsEx.pas"/>
|
||||
<UnitName Value="GraphicsEx"/>
|
||||
</Item9>
|
||||
<Item10>
|
||||
<Filename Value="data\MsgBoxes.pas"/>
|
||||
<UnitName Value="sfp_msgboxes"/>
|
||||
</Item10>
|
||||
</Files>
|
||||
<RequiredPkgs Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="dd_versioninfo"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="FCL"/>
|
||||
</Item3>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)"/>
|
||||
</UsageOptions>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<CustomOptions Items="ExternHelp" Version="2">
|
||||
<_ExternHelp Items="Count"/>
|
||||
</CustomOptions>
|
||||
</Package>
|
||||
</CONFIG>
|
22
ANB ST CP/anbstcp.pas
Normal file
22
ANB ST CP/anbstcp.pas
Normal file
@@ -0,0 +1,22 @@
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit ANBSTCP;
|
||||
|
||||
{$warn 5023 off : no warning about unused units}
|
||||
interface
|
||||
|
||||
uses
|
||||
ANBFormatString, ParamsMngr, SimplyINI, VCLEx, ANBInputBox, VersionControl,
|
||||
SimplyJSON, FileUtilsEx, GraphicsEx, MsgBoxes, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('ANBSTCP', @Register);
|
||||
end.
|
72
ANB ST CP/data/ANBFormatString.pas
Normal file
72
ANB ST CP/data/ANBFormatString.pas
Normal file
@@ -0,0 +1,72 @@
|
||||
unit ANBFormatString;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses StrUtils, SysUtils, VCLEx;
|
||||
{stdcalls}
|
||||
function FormatStr(const AFrmtdStr: String; const AArgs, AArgsValues: array of String): String; STDCALL;
|
||||
function FormatStrW(const AFrmtdStr: WideString; const AArgs, AArgsValues: array of WideString): WideString; STDCALL;
|
||||
implementation
|
||||
function SearchAndReplaceStr(const AStr, ASearchStr, AReplaceStr: String): String;
|
||||
var CurrDelim, NextDelim: IntEx;
|
||||
ElemName, s: String;
|
||||
begin
|
||||
s:= '';
|
||||
CurrDelim:= 1;
|
||||
repeat
|
||||
NextDelim:= PosEx(ASearchStr, AStr, CurrDelim);
|
||||
if NextDelim = 0 then
|
||||
NextDelim:= Length(AStr) + 1;
|
||||
ElemName:= Copy(AStr, CurrDelim, NextDelim - CurrDelim);
|
||||
if not (NextDelim > Length(AStr)) then
|
||||
s:= s + ElemName + AReplaceStr
|
||||
else
|
||||
s:= s + ElemName;
|
||||
CurrDelim:= NextDelim + Length(ASearchStr);
|
||||
until CurrDelim > Length(AStr);
|
||||
Result:= s;
|
||||
end;
|
||||
{Only for Windows}
|
||||
function SearchAndReplaceStrW(const AStr, ASearchStr, AReplaceStr: WideString): WideString;
|
||||
var CurrDelim, NextDelim: IntEx;
|
||||
ElemName, s: WideString;
|
||||
begin
|
||||
s:= '';
|
||||
CurrDelim:= 1;
|
||||
repeat
|
||||
NextDelim:= PosEx(ASearchStr, AStr, CurrDelim);
|
||||
if NextDelim = 0 then
|
||||
NextDelim:= Length(AStr) + 1;
|
||||
ElemName:= Copy(AStr, CurrDelim, NextDelim - CurrDelim);
|
||||
if not (NextDelim > Length(AStr)) then
|
||||
s:= s + ElemName + AReplaceStr
|
||||
else
|
||||
s:= s + ElemName;
|
||||
CurrDelim:= NextDelim + Length(ASearchStr);
|
||||
until CurrDelim > Length(AStr);
|
||||
Result:= s;
|
||||
end;
|
||||
function FormatStr(const AFrmtdStr: string; const AArgs, AArgsValues: array of String): String;
|
||||
var i: IntEx;
|
||||
s: String;
|
||||
begin
|
||||
s:= AFrmtdStr;
|
||||
if High(AArgs) <> High(AArgsValues) then
|
||||
raise Exception.Create('Array of arguments not equal array of its values!');
|
||||
for i:= 0 to High(AArgs) do
|
||||
s:= SearchAndReplaceStr(s, AArgs[i], AArgsValues[i]);
|
||||
Result:= s;
|
||||
end;
|
||||
{Only for Windows}
|
||||
function FormatStrW(const AFrmtdStr: WideString; const AArgs, AArgsValues: array of WideString): WideString;
|
||||
var i: IntEx;
|
||||
s: WideString;
|
||||
begin
|
||||
s:= AFrmtdStr;
|
||||
if High(AArgs) <> High(AArgsValues) then
|
||||
raise Exception.Create('Array of arguments not equal array of its values!');
|
||||
for i:= 0 to High(AArgs) do
|
||||
s:= SearchAndReplaceStrW(s, AArgs[i], AArgsValues[i]);
|
||||
Result:= s;
|
||||
end;
|
||||
end.
|
401
ANB ST CP/data/ANBInputBox.pas
Normal file
401
ANB ST CP/data/ANBInputBox.pas
Normal file
@@ -0,0 +1,401 @@
|
||||
unit ANBInputBox;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses LCLIntf, LCLType, SysUtils, Graphics, Controls, Forms, StdCtrls, Classes, Types, MaskEdit, Spin, VCLEx;
|
||||
function ShowInputBox (const ACaption, APrompt, ADefault: String; var isAccept: Boolean): String; OVERLOAD; STDCALL;
|
||||
function ShowInputBox (const ACaption, APrompt, ADefault: String; const ABtnCaptions: array of String; var isAccept: Boolean): String; OVERLOAD; STDCALL;
|
||||
function ShowInputBox (const ACaption, APrompt, ADefault: String; const ABtnCaptions: array of String; const AMaxLength: IntEx; var isAccept: Boolean): String; OVERLOAD; STDCALL;
|
||||
function ShowPasswordInputBox (const ACaption, APrompt, ADefault, APassword: String; var isAccept, isPasswordConfirmed: Boolean; const APasswordChar: Char = '*'): String; OVERLOAD; STDCALL;
|
||||
function ShowPasswordInputBox (const ACaption, APrompt, ADefault, APassword: String; var isAccept, isPasswordConfirmed: Boolean; const ABtnCaptions: array of String; const APasswordChar: Char = '*'): String; OVERLOAD; STDCALL;
|
||||
function ShowComboBox (const ACaption, APrompt: String; var Items: TStringList; const ADefaultIndex: IntEx; var isAccept: Boolean): IntEx; OVERLOAD; STDCALL;
|
||||
function ShowComboBox (const ACaption, APrompt: String; var Items: TStringList; const ADefaultIndex: IntEx; const ABtnsCaption: array of String; var isAccept: Boolean): IntEx; OVERLOAD; STDCALL;
|
||||
function ShowMaskedBox (const ACaption, APrompt, AMask, ADefault: String; const isIgnoreMask: Boolean; var isAccept: Boolean): String; OVERLOAD; STDCALL;
|
||||
function ShowMaskedBox (const ACaption, APrompt, AMask, ADefault: String; const isIgnoreMask: Boolean; const ABtnCaptions: array of String; const AMaxLength: IntEx; var isAccept: Boolean): String; OVERLOAD; STDCALL;
|
||||
function ShowSpinedBox (const ACaption, APrompt: String; const ADefault: IntEx; var isAccept: Boolean): IntEx; STDCALL; OVERLOAD;
|
||||
function ShowSpinedBox (const ACaption, APrompt: String; const ADefault, AMinValue, AMaxValue: IntEx; const ABtnCaptions: array of String; var isAccept: Boolean): IntEx; STDCALL; OVERLOAD;
|
||||
const OkBtnDefCaption: String = '&Ok';
|
||||
CancelBtnDefCaption: String = 'C&ancel';
|
||||
implementation
|
||||
function MyGetAveCharSize(Canvas: TCanvas): TPoint;
|
||||
var I: IntEx;
|
||||
Buffer: array[0..51] of Char;
|
||||
begin
|
||||
with Result do
|
||||
begin
|
||||
x:= 0;
|
||||
y:= 0;
|
||||
end;
|
||||
for I:= 0 to 25 do
|
||||
Buffer[I]:= Chr(I + Ord('A'));
|
||||
for I:= 0 to 25 do
|
||||
Buffer[I + 26]:= Chr(I + Ord('a'));
|
||||
GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));
|
||||
Result.X:= Result.X div 52;
|
||||
end;
|
||||
function MyInputQuery(const ACaption, APrompt: String; var Value: String; var APasswordConfirmed: Boolean; const APassword: Boolean; const ANeedPassword: String; const APasswordChar: Char; const AMaxLength: IntEx; const ABtnsCaption: array of String): Boolean;
|
||||
var Form: TForm;
|
||||
Prompt: TLabel;
|
||||
Edit: TEdit;
|
||||
DialogUnits: TPoint;
|
||||
ButtonTop, ButtonWidth, ButtonHeight: IntEx;
|
||||
begin
|
||||
Result:= false;
|
||||
Form:= TForm.Create(Application);
|
||||
with Form do
|
||||
try
|
||||
Canvas.Font:= Font;
|
||||
DialogUnits:= MyGetAveCharSize(Canvas);
|
||||
BorderStyle:= bsDialog;
|
||||
Caption:= ACaption;
|
||||
ClientWidth:= MulDiv(180, DialogUnits.X, 4);
|
||||
Position:= poScreenCenter;
|
||||
Color:= clBtnFace;
|
||||
Prompt:= TLabel.Create(Form);
|
||||
with Prompt do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= APrompt;
|
||||
Left:= MulDiv(8, DialogUnits.X, 4);
|
||||
Top:= MulDiv(8, DialogUnits.Y, 8);
|
||||
Constraints.MaxWidth:= MulDiv(164, DialogUnits.X, 4);
|
||||
WordWrap:= True;
|
||||
end;
|
||||
Edit:= TEdit.Create(Form);
|
||||
with Edit do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Left:= Prompt.Left;
|
||||
Top:= Prompt.Top + Prompt.Height + 5;
|
||||
Width:= MulDiv(164, DialogUnits.X, 4);
|
||||
MaxLength:= AMaxLength;
|
||||
if APassword then
|
||||
PasswordChar:= APasswordChar;
|
||||
Text:= Value;
|
||||
SelectAll;
|
||||
end;
|
||||
ButtonTop:= Edit.Top + Edit.Height + 15;
|
||||
ButtonWidth:= MulDiv(50, DialogUnits.X, 4);
|
||||
ButtonHeight:= MulDiv(14, DialogUnits.Y, 8);
|
||||
with TButton.Create(Form) do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= ABtnsCaption[0];
|
||||
ModalResult:= mrOk;
|
||||
Cursor:= crHandPoint;
|
||||
Default:= True;
|
||||
SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth, ButtonHeight);
|
||||
end;
|
||||
with TButton.Create(Form) do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= ABtnsCaption[1];
|
||||
ModalResult:= mrCancel;
|
||||
Cursor:= crHandPoint;
|
||||
Cancel:= True;
|
||||
SetBounds(MulDiv(92, DialogUnits.X, 4), Edit.Top + Edit.Height + 15, ButtonWidth, ButtonHeight);
|
||||
Form.ClientHeight:= Top + Height + 13;
|
||||
end;
|
||||
if ShowModal = mrOk then
|
||||
begin
|
||||
Value:= Edit.Text;
|
||||
if APassword then
|
||||
if Value = ANeedPassword then
|
||||
APasswordConfirmed:= true
|
||||
else
|
||||
APasswordConfirmed:= false;
|
||||
Result:= True;
|
||||
end;
|
||||
finally
|
||||
Form.Free;
|
||||
end;
|
||||
end;
|
||||
function MyInputComboQuery(const ACaption, APrompt: String; const Values: TStringList; const DefIndex: IntEx; var SelectedIndex: IntEx; const ABtnsCaption: array of String): Boolean;
|
||||
var Form: TForm;
|
||||
Prompt: TLabel;
|
||||
Combo: TComboBox;
|
||||
DialogUnits: TPoint;
|
||||
ButtonTop, ButtonWidth, ButtonHeight: IntEx;
|
||||
begin
|
||||
Result:= false;
|
||||
Form:= TForm.Create(Application);
|
||||
with Form do
|
||||
try
|
||||
Canvas.Font:= Font;
|
||||
DialogUnits:= MyGetAveCharSize(Canvas);
|
||||
BorderStyle:= bsDialog;
|
||||
Caption:= ACaption;
|
||||
ClientWidth:= MulDiv(180, DialogUnits.X, 4);
|
||||
Position:= poScreenCenter;
|
||||
Color:= clBtnFace;
|
||||
Prompt:= TLabel.Create(Form);
|
||||
with Prompt do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= APrompt;
|
||||
Left:= MulDiv(8, DialogUnits.X, 4);
|
||||
Top:= MulDiv(8, DialogUnits.Y, 8);
|
||||
Constraints.MaxWidth:= MulDiv(164, DialogUnits.X, 4);
|
||||
WordWrap:= True;
|
||||
end;
|
||||
Combo:= TComboBox.Create(Form);
|
||||
with Combo do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Left:= Prompt.Left;
|
||||
Top:= Prompt.Top + Prompt.Height + 5;
|
||||
Width:= MulDiv(164, DialogUnits.X, 4);
|
||||
Style:= csDropDownList;
|
||||
Items.Assign(Values);
|
||||
if DefIndex <= Items.Count - 1 then
|
||||
ItemIndex:= DefIndex
|
||||
else
|
||||
ItemIndex:= -1;
|
||||
end;
|
||||
ButtonTop:= Combo.Top + Combo.Height + 15;
|
||||
ButtonWidth:= MulDiv(50, DialogUnits.X, 4);
|
||||
ButtonHeight:= MulDiv(14, DialogUnits.Y, 8);
|
||||
with TButton.Create(Form) do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= ABtnsCaption[0];
|
||||
ModalResult:= mrOk;
|
||||
Cursor:= crHandPoint;
|
||||
Default:= True;
|
||||
SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth, ButtonHeight);
|
||||
end;
|
||||
with TButton.Create(Form) do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= ABtnsCaption[1];
|
||||
ModalResult:= mrCancel;
|
||||
Cursor:= crHandPoint;
|
||||
Cancel:= True;
|
||||
SetBounds(MulDiv(92, DialogUnits.X, 4), Combo.Top + Combo.Height + 15, ButtonWidth, ButtonHeight);
|
||||
Form.ClientHeight:= Top + Height + 13;
|
||||
end;
|
||||
if ShowModal = mrOk then
|
||||
begin
|
||||
SelectedIndex:= Combo.ItemIndex;
|
||||
Result:= True;
|
||||
end;
|
||||
finally
|
||||
Form.Free;
|
||||
end;
|
||||
end;
|
||||
function MyInputMaskQuery(const ACaption, APrompt, AMask: String; var Value: String; const isIgnoreMask: Boolean; const AMaxLength: IntEx; const ABtnsCaption: array of String): Boolean;
|
||||
var Form: TForm;
|
||||
Prompt: TLabel;
|
||||
Edit: TMaskEdit;
|
||||
DialogUnits: TPoint;
|
||||
ButtonTop, ButtonWidth, ButtonHeight: IntEx;
|
||||
begin
|
||||
Result:= false;
|
||||
Form:= TForm.Create(Application);
|
||||
with Form do
|
||||
try
|
||||
Canvas.Font:= Font;
|
||||
DialogUnits:= MyGetAveCharSize(Canvas);
|
||||
BorderStyle:= bsDialog;
|
||||
Caption:= ACaption;
|
||||
ClientWidth:= MulDiv(180, DialogUnits.X, 4);
|
||||
Position:= poScreenCenter;
|
||||
Color:= clBtnFace;
|
||||
Prompt:= TLabel.Create(Form);
|
||||
with Prompt do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= APrompt;
|
||||
Left:= MulDiv(8, DialogUnits.X, 4);
|
||||
Top:= MulDiv(8, DialogUnits.Y, 8);
|
||||
Constraints.MaxWidth:= MulDiv(164, DialogUnits.X, 4);
|
||||
WordWrap:= True;
|
||||
end;
|
||||
Edit:= TMaskEdit.Create(Form);
|
||||
with Edit do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Left:= Prompt.Left;
|
||||
Top:= Prompt.Top + Prompt.Height + 5;
|
||||
Width:= MulDiv(164, DialogUnits.X, 4);
|
||||
MaxLength:= AMaxLength;
|
||||
EditMask:= AMask;
|
||||
if isIgnoreMask then
|
||||
Text:= Value
|
||||
else
|
||||
EditText:= Value;
|
||||
ValidateEdit;
|
||||
end;
|
||||
ButtonTop:= Edit.Top + Edit.Height + 15;
|
||||
ButtonWidth:= MulDiv(50, DialogUnits.X, 4);
|
||||
ButtonHeight:= MulDiv(14, DialogUnits.Y, 8);
|
||||
with TButton.Create(Form) do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= ABtnsCaption[0];
|
||||
ModalResult:= mrOk;
|
||||
Cursor:= crHandPoint;
|
||||
Default:= True;
|
||||
SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth, ButtonHeight);
|
||||
end;
|
||||
with TButton.Create(Form) do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= ABtnsCaption[1];
|
||||
ModalResult:= mrCancel;
|
||||
Cursor:= crHandPoint;
|
||||
Cancel:= True;
|
||||
SetBounds(MulDiv(92, DialogUnits.X, 4), Edit.Top + Edit.Height + 15, ButtonWidth, ButtonHeight);
|
||||
Form.ClientHeight:= Top + Height + 13;
|
||||
end;
|
||||
if ShowModal = mrOk then
|
||||
begin
|
||||
if isIgnoreMask then
|
||||
Value:= Edit.Text
|
||||
else
|
||||
Value:= Edit.EditText;
|
||||
Result:= True;
|
||||
end;
|
||||
finally
|
||||
Form.Free;
|
||||
end;
|
||||
end;
|
||||
function MyInputSpinQuery(const ACaption, APrompt: String; var _Value: IntEx; const AMinValue, AMaxValue: IntEx; const ABtnsCaption: array of String): Boolean;
|
||||
var Form: TForm;
|
||||
Prompt: TLabel;
|
||||
Edit: TSpinEdit;
|
||||
DialogUnits: TPoint;
|
||||
ButtonTop, ButtonWidth, ButtonHeight: IntEx;
|
||||
begin
|
||||
Result:= False;
|
||||
Form:= TForm.Create(Application);
|
||||
with Form do
|
||||
try
|
||||
Canvas.Font:= Font;
|
||||
DialogUnits:= MyGetAveCharSize(Canvas);
|
||||
BorderStyle:= bsDialog;
|
||||
Caption:= ACaption;
|
||||
ClientWidth:= MulDiv(180, DialogUnits.X, 4);
|
||||
Position:= poScreenCenter;
|
||||
Color:= clBtnFace;
|
||||
Prompt:= TLabel.Create(Form);
|
||||
with Prompt do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= APrompt;
|
||||
Left:= MulDiv(8, DialogUnits.X, 4);
|
||||
Top:= MulDiv(8, DialogUnits.Y, 8);
|
||||
Constraints.MaxWidth:= MulDiv(164, DialogUnits.X, 4);
|
||||
WordWrap:= True;
|
||||
end;
|
||||
Edit:= TSpinEdit.Create(Form);
|
||||
with Edit do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Left:= Prompt.Left;
|
||||
Top:= Prompt.Top + Prompt.Height + 5;
|
||||
Width:= MulDiv(164, DialogUnits.X, 4);
|
||||
MinValue:= Integer(AMinValue);
|
||||
MaxValue:= Integer(AMaxValue);
|
||||
if _Value < AMinValue then
|
||||
Value:= AMinValue
|
||||
else
|
||||
if _Value > AMaxValue then
|
||||
Value:= AMaxValue
|
||||
else
|
||||
Value:= _Value;
|
||||
SelectAll;
|
||||
end;
|
||||
ButtonTop:= Edit.Top + Edit.Height + 15;
|
||||
ButtonWidth:= MulDiv(50, DialogUnits.X, 4);
|
||||
ButtonHeight:= MulDiv(14, DialogUnits.Y, 8);
|
||||
with TButton.Create(Form) do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= ABtnsCaption[0];
|
||||
ModalResult:= mrOk;
|
||||
Cursor:= crHandPoint;
|
||||
Default:= True;
|
||||
SetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth, ButtonHeight);
|
||||
end;
|
||||
with TButton.Create(Form) do
|
||||
begin
|
||||
Parent:= Form;
|
||||
Caption:= ABtnsCaption[1];
|
||||
ModalResult:= mrCancel;
|
||||
Cursor:= crHandPoint;
|
||||
Cancel:= True;
|
||||
SetBounds(MulDiv(92, DialogUnits.X, 4), Edit.Top + Edit.Height + 15, ButtonWidth, ButtonHeight);
|
||||
Form.ClientHeight:= Top + Height + 13;
|
||||
end;
|
||||
if ShowModal = mrOk then
|
||||
begin
|
||||
_Value:= Edit.Value;
|
||||
Result:= True;
|
||||
end;
|
||||
finally
|
||||
Form.Free;
|
||||
end;
|
||||
end;
|
||||
function ShowInputBox (const ACaption, APrompt, ADefault: String; var isAccept: Boolean): String;
|
||||
var Pasw: boolean;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
Pasw:= False;
|
||||
isAccept:= MyInputQuery(ACaption, APrompt, Result, Pasw, False, '', '*', 0, [OkBtnDefCaption, CancelBtnDefCaption]);
|
||||
end;
|
||||
function ShowInputBox (const ACaption, APrompt, ADefault: String; const ABtnCaptions: array of String; var isAccept: Boolean): String;
|
||||
var Pasw: boolean;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
Pasw:= False;
|
||||
isAccept:= MyInputQuery(ACaption, APrompt, Result, Pasw, False, '', '*', 0, ABtnCaptions);
|
||||
end;
|
||||
function ShowInputBox (const ACaption, APrompt, ADefault: String; const ABtnCaptions: array of String; const AMaxLength: IntEx; var isAccept: Boolean): String;
|
||||
var Pasw: boolean;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
Pasw:= False;
|
||||
isAccept:= MyInputQuery(ACaption, APrompt, Result, Pasw, false, '', '*', AMaxLength, ABtnCaptions);
|
||||
end;
|
||||
function ShowPasswordInputBox (const ACaption, APrompt, ADefault, APassword: String; var isAccept, isPasswordConfirmed: Boolean; const APasswordChar: Char = '*'): String;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
isAccept:= MyInputQuery(ACaption, APrompt, Result, isPasswordConfirmed, True, APassword, APasswordChar, 0, [OkBtnDefCaption, CancelBtnDefCaption]);
|
||||
end;
|
||||
function ShowPasswordInputBox (const ACaption, APrompt, ADefault, APassword: String; var isAccept, isPasswordConfirmed: Boolean; const ABtnCaptions: array of String; const APasswordChar: Char = '*'): String;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
isAccept:= MyInputQuery(ACaption, APrompt, Result, isPasswordConfirmed, True, APassword, APasswordChar, 0, ABtnCaptions);
|
||||
end;
|
||||
function ShowComboBox (const ACaption, APrompt: string; var Items: TStringList; const ADefaultIndex: IntEx; var isAccept: boolean): IntEx;
|
||||
begin
|
||||
Result:= ADefaultIndex;
|
||||
isAccept:= MyInputComboQuery(ACaption, APrompt, Items, Result, Result, [OkBtnDefCaption, CancelBtnDefCaption]);
|
||||
end;
|
||||
function ShowComboBox (const ACaption, APrompt: String; var Items: TStringList; const ADefaultIndex: IntEx; const ABtnsCaption: array of String; var isAccept: Boolean): IntEx;
|
||||
begin
|
||||
Result:= ADefaultIndex;
|
||||
isAccept:= MyInputComboQuery(ACaption, APrompt, Items, Result, Result, ABtnsCaption);
|
||||
end;
|
||||
function ShowMaskedBox (const ACaption, APrompt, AMask, ADefault: String; const isIgnoreMask: Boolean; var isAccept: Boolean): String;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
isAccept:= MyInputMaskQuery(ACaption, APrompt, AMask, Result, isIgnoreMask, 0, [OkBtnDefCaption, CancelBtnDefCaption]);
|
||||
end;
|
||||
function ShowMaskedBox (const ACaption, APrompt, AMask, ADefault: String; const isIgnoreMask: Boolean; const ABtnCaptions: array of String; const AMaxLength: IntEx; var isAccept: Boolean): String;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
isAccept:= MyInputMaskQuery(ACaption, APrompt, AMask, Result, isIgnoreMask, AMaxLength, ABtnCaptions);
|
||||
end;
|
||||
function ShowSpinedBox (const ACaption, APrompt: String; const ADefault: IntEx; var isAccept: Boolean): IntEx;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
isAccept:= MyInputSpinQuery(ACaption, APrompt, Result, 0, 100, [OkBtnDefCaption, CancelBtnDefCaption]);
|
||||
end;
|
||||
function ShowSpinedBox (const ACaption, APrompt: String; const ADefault, AMinValue, AMaxValue: IntEx; const ABtnCaptions: array of String; var isAccept: Boolean): IntEx;
|
||||
begin
|
||||
Result:= ADefault;
|
||||
isAccept:= MyInputSpinQuery(ACaption, APrompt, Result, AMinValue, AMaxValue, ABtnCaptions);
|
||||
end;
|
||||
end.
|
12
ANB ST CP/data/ANBRegComp.pas
Normal file
12
ANB ST CP/data/ANBRegComp.pas
Normal file
@@ -0,0 +1,12 @@
|
||||
unit ANBRegComp;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, SkinButton;
|
||||
procedure Register;
|
||||
implementation
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('ANB Components', [TSkinBtn]);
|
||||
end;
|
||||
end.
|
169
ANB ST CP/data/FileUtilsEx.pas
Normal file
169
ANB ST CP/data/FileUtilsEx.pas
Normal file
@@ -0,0 +1,169 @@
|
||||
//version 0.31 beta
|
||||
unit FileUtilsEx;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses windows, sysutils, ShellApi, Classes;
|
||||
type TExePlatform = (expUnknown, exp32Bit, exp64Bit, expOther);
|
||||
//stdcalls
|
||||
function FileVersion (AFileName: String): String;
|
||||
function FileSize2Str (const AFileSize: Int64; AStringNames: Array of String; const ADecimalPlaces: Byte): String; Stdcall; Overload;
|
||||
function FileSize2Str (const AFileSize: Int64; AStringNames: Array of String): String; Stdcall; Overload;
|
||||
function FileSize2Str (const AFileSize: Int64; const ADecimalPlaces: Byte): String; Overload;
|
||||
function FileSize2Str (const AFileSize: Int64): String; Overload;
|
||||
function FileAccessDateToDateTime (FileTime: TFILETIME): TDateTime; Stdcall;
|
||||
function RenameDir (const DirName, NewName: String): Boolean; STDCALL;
|
||||
function GetEXEPlatform (const AFileName: String): TExePlatform; STDCALL;
|
||||
implementation
|
||||
const AFileSizeNames: Array[0..4] of String = ('Byte', 'KB', 'MB', 'GB', 'TB');
|
||||
//Getting version of the file
|
||||
function FileVersion (AFileName: String): String;
|
||||
var szName: array[0..255] of Char;
|
||||
P: Pointer;
|
||||
Value: Pointer;
|
||||
Len: UINT;
|
||||
GetTranslationString: String;
|
||||
FFileName: PChar;
|
||||
FValid:boolean;
|
||||
FSize: DWORD;
|
||||
FHandle: DWORD;
|
||||
FBuffer: PChar;
|
||||
begin
|
||||
try
|
||||
FFileName:= StrPCopy(StrAlloc(Length(AFileName) + 1), AFileName);
|
||||
FValid:= False;
|
||||
FSize:= GetFileVersionInfoSize(FFileName, FHandle);
|
||||
if FSize > 0 then
|
||||
try
|
||||
GetMem(FBuffer, FSize);
|
||||
FValid:= GetFileVersionInfo(FFileName, FHandle, FSize, FBuffer);
|
||||
except
|
||||
FValid:= False;
|
||||
raise;
|
||||
end;
|
||||
Result:= '';
|
||||
if FValid then
|
||||
VerQueryValue(FBuffer, '\VarFileInfo\Translation', P, Len)
|
||||
else
|
||||
P:= nil;
|
||||
if P <> nil then
|
||||
GetTranslationString:= IntToHex(MakeLong(HiWord(Longint(P^)), LoWord(Longint(P^))), 8);
|
||||
if FValid then
|
||||
begin
|
||||
StrPCopy(szName, '\StringFileInfo\' + GetTranslationString + '\FileVersion');
|
||||
if VerQueryValue(FBuffer, szName, Value, Len) then
|
||||
Result:= StrPas(PChar(Value));
|
||||
end;
|
||||
finally
|
||||
try
|
||||
if FBuffer <> nil then
|
||||
FreeMem(FBuffer, FSize);
|
||||
except
|
||||
end;
|
||||
try
|
||||
StrDispose(FFileName);
|
||||
except
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//FileSize2Str
|
||||
function FileSize2Str (const AFileSize: Int64; AStringNames: Array of String; const ADecimalPlaces: Byte): String; Overload;
|
||||
function FrmtSize (const ASize, ADelim: Int64; const ADP: Byte): String;
|
||||
var VDelim: Int64;
|
||||
Indx: Byte;
|
||||
begin
|
||||
VDelim:= 1;
|
||||
for Indx:= 0 to ADP do
|
||||
VDelim:= VDelim*10;
|
||||
Result:= FloatToStr(round((ASize*VDelim)/ADelim)/VDelim);
|
||||
end;
|
||||
const AFrmtsStr: String = '%s %s';
|
||||
begin
|
||||
//Bytes
|
||||
if AFileSize < 1024 then
|
||||
Result:= Format(AFrmtsStr, [IntToStr(AFileSize), AStringNames[0]]);
|
||||
//KiloBytes
|
||||
if (AFileSize >= 1024) and (AFileSize < 1048576) then
|
||||
Result:= Format(AFrmtsStr, [FrmtSize(AFileSize, 1024, ADecimalPlaces), AStringNames[1]]);
|
||||
//MegaBytes
|
||||
if (AFileSize >= 1048576) and (AFileSize < 1073741824) then
|
||||
Result:= Format(AFrmtsStr, [FrmtSize(AFileSize, 1048576, ADecimalPlaces), AStringNames[2]]);
|
||||
//GigaBytes
|
||||
if (AFileSize >= 1073741824) and (AFileSize < 1099511627776) then
|
||||
Result:= Format(AFrmtsStr, [FrmtSize(AFileSize, 1073741824, ADecimalPlaces), AStringNames[3]]);
|
||||
//TeraBytes
|
||||
if (AFileSize >= 1099511627776) then
|
||||
Result:= Format(AFrmtsStr, [FrmtSize(AFileSize, 1073741824, ADecimalPlaces), AStringNames[4]]);
|
||||
end;
|
||||
function FileSize2Str (const AFileSize: Int64; AStringNames: Array of String): String; Overload;
|
||||
begin
|
||||
Result:= FileSize2Str(AFileSize, AStringNames, 2);
|
||||
end;
|
||||
function FileSize2Str (const AFileSize: Int64; const ADecimalPlaces: Byte): String; Overload;
|
||||
begin
|
||||
Result:= FileSize2Str(AFileSize, AFileSizeNames, ADecimalPlaces);
|
||||
end;
|
||||
function FileSize2Str (const AFileSize: Int64): String; Overload;
|
||||
begin
|
||||
Result:= FileSize2Str(AFileSize, AFileSizeNames, 2);
|
||||
end;
|
||||
//FileAccessDateToDateTime
|
||||
//Author: Дураг (http://www.sql.ru/forum/memberinfo.aspx?mid=32731) from http://www.sql.ru/forum/259218/kak-poluchit-datu-i-vremya-sozdaniya-fayla
|
||||
function FileAccessDateToDateTime (FileTime: TFILETIME): TDateTime;
|
||||
var LocalTime: TFILETIME;
|
||||
DOSFileTime: DWORD;
|
||||
begin
|
||||
FileTimeToLocalFileTime(FileTime, LocalTime);
|
||||
FileTimeToDosDateTime(LocalTime, LongRec(DOSFileTime).Hi, LongRec(DOSFileTime).Lo);
|
||||
Result:= FileDateToDateTime(DOSFileTime);
|
||||
end;
|
||||
//RenameDir
|
||||
function RenameDir (const DirName, NewName: String): Boolean;
|
||||
var shellinfo: TSHFILEOPSTRUCT;
|
||||
DirFrom, DirTo: String;
|
||||
begin
|
||||
DirFrom:= DirName;
|
||||
DirTo:= NewName;
|
||||
with shellinfo do
|
||||
begin
|
||||
Wnd:= 0;
|
||||
wFunc:= FO_RENAME;
|
||||
pFrom:= PChar(DirFrom);
|
||||
pTo:= PChar(DirTo);
|
||||
fFlags:= FOF_FILESONLY or FOF_ALLOWUNDO or FOF_SILENT or FOF_NOCONFIRMATION;
|
||||
end;
|
||||
SHFileOperation(shellinfo);
|
||||
Result:= DirectoryExists(NewName);
|
||||
end;
|
||||
//GetEXEPlatform
|
||||
//Author Dmitry Arefiev (http://www.sql.ru/forum/808857/kak-opredelit-razryadnost-prilozheniya)
|
||||
function GetEXEPlatform (const AFileName: String): TExePlatform;
|
||||
var oFS: TFileStream;
|
||||
iPeOffset: Integer;
|
||||
iPeHead: LongWord;
|
||||
iMachineType: Word;
|
||||
begin
|
||||
Result:= expUnknown;
|
||||
try
|
||||
oFS:= TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone);
|
||||
try
|
||||
oFS.Seek($3C, soFromBeginning);
|
||||
oFS.Read(iPeOffset, SizeOf(iPeOffset));
|
||||
oFS.Seek(iPeOffset, soFromBeginning);
|
||||
oFS.Read(iPeHead, SizeOf(iPeHead));
|
||||
if iPeHead <> $00004550 then
|
||||
Exit;
|
||||
oFS.Read(iMachineType, SizeOf(iMachineType));
|
||||
case iMachineType of
|
||||
$8664, $0200: Result:= exp64Bit;
|
||||
$014C: Result:= exp32Bit;
|
||||
else
|
||||
Result:= expOther;
|
||||
end;
|
||||
finally
|
||||
oFS.Free;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
end.
|
28
ANB ST CP/data/GraphicsEx.pas
Normal file
28
ANB ST CP/data/GraphicsEx.pas
Normal file
@@ -0,0 +1,28 @@
|
||||
unit GraphicsEx;
|
||||
//version 0.1
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, Graphics;
|
||||
type TRGBByte = 0..255;
|
||||
TRGBColor = record
|
||||
R, G, B: TRGBByte;
|
||||
end;
|
||||
//stdcalls
|
||||
function RGB2Color (const ARGB: TRGBColor): TColor;
|
||||
function Color2RGB (const AColor: TColor): TRGBColor;
|
||||
implementation
|
||||
function RGB2Color (const ARGB: TRGBColor): TColor;
|
||||
begin
|
||||
Result:= RGBToColor(ARGB.R, ARGB.G, ARGB.B);
|
||||
end;
|
||||
function Color2RGB (const AColor: TColor): TRGBColor;
|
||||
//from http://www.delphisources.ru/pages/faq/base/rgb_tcolor.html
|
||||
var Color: LongInt;
|
||||
begin
|
||||
Color:= ColorToRGB(AColor);
|
||||
Result.R:= Color;
|
||||
Result.G:= Color shr 8;
|
||||
Result.B:= Color shr 16;
|
||||
end;
|
||||
end.
|
25
ANB ST CP/data/MsgBoxes.pas
Normal file
25
ANB ST CP/data/MsgBoxes.pas
Normal file
@@ -0,0 +1,25 @@
|
||||
unit MsgBoxes;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, Forms;
|
||||
{dialog types for Linux capatability}
|
||||
const DLG_ASTERISK = $40;
|
||||
DLG_EXCLAMATION = $30;
|
||||
DLG_WARNING = $30;
|
||||
DLG_ERROR = $10;
|
||||
DLG_QUESTION = $20;
|
||||
{stdcalls}
|
||||
function ShowMessageBox (const AText, ATitle: String; const AMessageType: LongInt = 0): Integer; STDCALL;
|
||||
function ShowMessageBoxA (const AText: String; const AMessageType: LongInt = 0): Integer; STDCALL;
|
||||
implementation
|
||||
//Sample Windows MessageDialogs
|
||||
function ShowMessageBox (const AText, ATitle: String; const AMessageType: LongInt = 0): Integer;
|
||||
begin
|
||||
Result:= Application.MessageBox(PChar(AText), PChar(ATitle), AMessageType);
|
||||
end;
|
||||
function ShowMessageBoxA (const AText: String; const AMessageType: LongInt = 0): Integer;
|
||||
begin
|
||||
Result:= Application.MessageBox(PChar(AText), PChar(Application.Title), AMessageType);
|
||||
end;
|
||||
end.
|
96
ANB ST CP/data/ParamsMngr.pas
Normal file
96
ANB ST CP/data/ParamsMngr.pas
Normal file
@@ -0,0 +1,96 @@
|
||||
unit ParamsMngr;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses StrUtils, VCLEx;
|
||||
{stdcalls}
|
||||
function HasParam (const AParams: String; const AParam: Char): Boolean; OVERLOAD; STDCALL;
|
||||
function HasParam (const AParams: String; const AParam: String): Boolean; OVERLOAD; STDCALL;
|
||||
function HasParam (const AParam: String): Boolean; OVERLOAD; STDCALL;
|
||||
function GetParamValue (const AParams: String; const AParam: Char): String; OVERLOAD; STDCALL;
|
||||
function GetParamValue (const AParams: String; const AParam: String): String; OVERLOAD; STDCALL;
|
||||
function GetParamValue (const AParam: string): string; overload; stdcall;
|
||||
function StartParams: String; STDCALL;
|
||||
implementation
|
||||
function HasParam (const AParams: String; const AParam: Char): Boolean;
|
||||
begin
|
||||
Result:= False;
|
||||
if AParams <> '' then
|
||||
if Pos('/' + AParam, AParams) > 0 then
|
||||
Result:= True;
|
||||
end;
|
||||
function HasParam (const AParams: String; const AParam: String): Boolean;
|
||||
var PS: IntEx;
|
||||
NextChr: Char;
|
||||
begin
|
||||
Result:= False;
|
||||
if AParams <> '' then
|
||||
begin
|
||||
PS:= Pos('/' + AParam, AParams);
|
||||
if PS > 0 then
|
||||
begin
|
||||
NextChr:= AParams[PS + Length(AParam) + 1];
|
||||
if (NextChr = '=') or (NextChr = '#') then
|
||||
Result:= True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
function HasParam (const AParam: String): Boolean;
|
||||
begin
|
||||
Result:= HasParam(StartParams, AParam);
|
||||
end;
|
||||
function GetParamValue (const AParams: String; const AParam: Char): String;
|
||||
var i, j, k: IntEx;
|
||||
begin
|
||||
Result:= '';
|
||||
i:= 0;
|
||||
j:= 0;
|
||||
k:= 0;
|
||||
if AParams <> '' then
|
||||
begin
|
||||
i:= Pos('/' + AParam, AParams);
|
||||
if (i > 0) and (AParams[i+2] = '=') then
|
||||
j:= i+3;
|
||||
if j > 0 then
|
||||
begin
|
||||
k:= PosEx('#', AParams, j);
|
||||
if k = 0 then
|
||||
k:= Length(AParams) + 1;
|
||||
Result:= Copy(AParams, j, k-j);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
function GetParamValue (const AParams: String; const AParam: String): String;
|
||||
var i, j, k: IntEx;
|
||||
begin
|
||||
Result:= '';
|
||||
i:= 0;
|
||||
j:= 0;
|
||||
k:= 0;
|
||||
if AParams <> '' then
|
||||
begin
|
||||
i:= Pos('/' + AParam, AParams);
|
||||
if (i > 0) and (AParams[i + Length(AParam) + 1] = '=') then
|
||||
j:= i + Length(AParam) + 2;
|
||||
if j > 0 then
|
||||
begin
|
||||
k:= PosEx('#', AParams, j);
|
||||
if k = 0 then
|
||||
k:= Length(AParams) + 1;
|
||||
Result:= Copy(AParams, j, k-j);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
function GetParamValue (const AParam: String): String;
|
||||
begin
|
||||
Result:= GetParamValue(StartParams, AParam);
|
||||
end;
|
||||
function StartParams: String;
|
||||
var i: IntEx;
|
||||
begin
|
||||
Result:= '';
|
||||
if Paramcount > 0 then
|
||||
for i:= 1 to Paramcount do
|
||||
Result:= Result + ParamStr(i) + '#';
|
||||
end;
|
||||
end.
|
132
ANB ST CP/data/SimplyINI.pas
Normal file
132
ANB ST CP/data/SimplyINI.pas
Normal file
@@ -0,0 +1,132 @@
|
||||
unit SimplyINI;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses SysUtils, Classes, IniFiles;
|
||||
//stdcalls
|
||||
function INIReadString (const ASection, AKey, ADefault, AFileName: string): string; stdcall;
|
||||
function INIReadInteger (const ASection, AKey: string; const ADefault: Int64; const AFileName: string): Int64; stdcall;
|
||||
function INIReadBoolean (const ASection, AKey: string; const ADefault: boolean; const AFileName: string): boolean; stdcall;
|
||||
procedure INIWriteString (const ASection, AKey, AValue, AFileName: string); stdcall;
|
||||
procedure INIWriteInteger (const ASection, AKey: string; const AValue: Int64; const AFileName: string); stdcall;
|
||||
procedure INIWriteBoolean (const ASection, AKey: string; const AValue: boolean; const AFileName: string); stdcall;
|
||||
procedure INIDeleteKey (const ASection, AKey, AFileName: string); stdcall;
|
||||
procedure INIDeleteSection (const ASection, AFileName: string); stdcall;
|
||||
function INISectionExists (const ASection, AFileName: string): boolean; stdcall;
|
||||
procedure INIReadSections (const AFileName: string; VStrings: TStrings); stdcall;
|
||||
procedure INIReadSection (const ASection, AFileName: string; VStrings: TStrings); stdcall;
|
||||
implementation
|
||||
//Read functions
|
||||
function INIReadString (const ASection, AKey, ADefault, AFileName: string): string;
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
Result:= INI.ReadString(ASection, AKey, ADefault);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
function INIReadInteger (const ASection, AKey: string; const ADefault: Int64; const AFileName: string): Int64;
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
Result:= INI.ReadInteger(ASection, AKey, ADefault);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
function INIReadBoolean (const ASection, AKey: string; const ADefault: boolean; const AFileName: string): boolean;
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
Result:= INI.ReadBool(ASection, AKey, ADefault);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
//Write procedures
|
||||
procedure INIWriteString (const ASection, AKey, AValue, AFileName: string);
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
INI.WriteString(ASection, AKey, AValue);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
procedure INIWriteInteger (const ASection, AKey: string; const AValue: Int64; const AFileName: string);
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
INI.WriteInt64(ASection, AKey, AValue);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
procedure INIWriteBoolean (const ASection, AKey: string; const AValue: boolean; const AFileName: string);
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
INI.WriteBool(ASection, AKey, AValue);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
//Delete function
|
||||
procedure INIDeleteKey (const ASection, AKey, AFileName: string);
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
INI.DeleteKey(ASection, AKey);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
procedure INIDeleteSection (const ASection, AFileName: string);
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
INI.EraseSection(ASection);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
function INISectionExists (const ASection, AFileName: string): boolean;
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
Result:= INI.SectionExists(ASection);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
procedure INIReadSections (const AFileName: string; VStrings: TStrings);
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
INI.ReadSections(VStrings);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
procedure INIReadSection (const ASection, AFileName: string; VStrings: TStrings);
|
||||
var INI: TIniFile;
|
||||
begin
|
||||
INI:= TIniFile.Create(AFileName);
|
||||
try
|
||||
INI.ReadSection(ASection, VStrings);
|
||||
finally
|
||||
INI.Free;
|
||||
end;
|
||||
end;
|
||||
end.
|
324
ANB ST CP/data/SimplyJSON.pas
Normal file
324
ANB ST CP/data/SimplyJSON.pas
Normal file
@@ -0,0 +1,324 @@
|
||||
unit SimplyJSON;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
{*************************************************************************************************************************************
|
||||
SimplyJSON
|
||||
Модуль для парсинга JSON файлов (используется TJSONConfig).
|
||||
Авторские права (c) 2016 - 2019, Александр Бабаев.
|
||||
История изменений:
|
||||
1.3 (01.05.2019) Переработан алгоритм открытия / парсинга JSON файлов при чтении, изменена функция JSReadFont
|
||||
1.2 (09.05.2017) Добавлены функции чтения/записи шрифтов.
|
||||
*************************************************************************************************************************************}
|
||||
interface
|
||||
uses Classes, SysUtils, Graphics, GraphicsEx, LazFileUtils, fpjson, jsonparser, jsonConf, ANBFormatString;
|
||||
//stdcalls
|
||||
function JSReadString (const AKey, ADefault: UnicodeString; const AFileName: String): UnicodeString; STDCALL; OVERLOAD;
|
||||
function JSReadString (const AKey, ADefault, AFileName: String): String; STDCALL; OVERLOAD;
|
||||
function JSReadInteger (const AKey: UnicodeString; const ADefault: Int64; const AFileName: String): Int64; STDCALL; OVERLOAD;
|
||||
function JSReadInteger (const AKey: String; const ADefault: Int64; const AFileName: String): Int64; STDCALL; OVERLOAD;
|
||||
function JSReadBoolean (const AKey: UnicodeString; const ADefault: Boolean; const AFileName: String): Boolean; STDCALL; OVERLOAD;
|
||||
function JSReadBoolean (const AKey: String; const ADefault: Boolean; const AFileName: String): Boolean; STDCALL; OVERLOAD;
|
||||
function JSReadRGBColor (const AKey: UnicodeString; const ADefault: TRGBColor; const AFileName: String): TRGBColor; STDCALL; OVERLOAD;
|
||||
function JSReadRGBColor (const AKey: String; const ADefault: TRGBColor; const AFileName: String): TRGBColor; STDCALL; OVERLOAD;
|
||||
procedure JSReadFont (const AKey: UnicodeString; var Font: TFont; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSReadFont (const AKey: String; var Font: TFont; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteString (const AKey, AValue: UnicodeString; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteString (const AKey, AValue, AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteInteger (const AKey: UnicodeString; const AValue: Int64; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteInteger (const AKey: String; const AValue: Int64; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteBoolean (const AKey: UnicodeString; const AValue: Boolean; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteBoolean (const AKey: String; const AValue: Boolean; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteRGBColor (const AKey: UnicodeString; const AValue: TRGBColor; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteRGBColor (const AKey: String; const AValue: TRGBColor; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteFont (const AKey: UnicodeString; const AValue: TFont; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSWriteFont (const AKey: String; const AValue: TFont; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSDeleteKey (const AKey: UnicodeString; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSDeleteKey (const AKey, AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSReadSubKeys (const AKey: UnicodeString; SubkeyList: TStrings; const AFileName: String); STDCALL; OVERLOAD;
|
||||
procedure JSReadSubKeys (const AKey: String; SubkeyList: TStrings; const AFileName: String); STDCALL; OVERLOAD;
|
||||
implementation
|
||||
//Support functions
|
||||
procedure GetJSData (const AFileName: String; var JSData: TJSONData);
|
||||
var FS: TFileStream;
|
||||
SL: TStringList;
|
||||
begin
|
||||
if not FileExistsUTF8(AFileName) then
|
||||
begin
|
||||
FS:= TFileStream.Create(AFileName, fmOpenWrite);
|
||||
SL:= TStringList.Create;
|
||||
SL.Text:= '{}';
|
||||
SL.SaveToStream(FS);
|
||||
SL.Free;
|
||||
FS.Free;
|
||||
end;
|
||||
FS:= TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone);
|
||||
JSData:= GetJSON(FS, True);
|
||||
FS.Free;
|
||||
end;
|
||||
function FrmtKey (const AKey: UnicodeString): UnicodeString;
|
||||
var KeyM: UnicodeString;
|
||||
begin
|
||||
Result:= AKey;
|
||||
//Для совместимости с SimplyJSON 1.0 - 1.2 и операциями записи
|
||||
KeyM:= AKey;
|
||||
if KeyM[1] = '/' then
|
||||
Delete(KeyM, 1, 1);
|
||||
Result:= UnicodeString(FormatStr(KeyM, ['/'], ['.']));
|
||||
end;
|
||||
//Read functions
|
||||
function JSReadString (const AKey, ADefault: UnicodeString; const AFileName: String): UnicodeString; OVERLOAD;
|
||||
var JD: TJSONData;
|
||||
begin
|
||||
GetJSData(AFileName, JD);
|
||||
try
|
||||
Result:= JD.FindPath(FrmtKey(AKey)).AsUnicodeString;
|
||||
except
|
||||
Result:= ADefault;
|
||||
end;
|
||||
JD.Free;
|
||||
end;
|
||||
function JSReadString (const AKey, ADefault, AFileName: String): String; OVERLOAD;
|
||||
var Key, Def, Res: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
Def:= UnicodeString(ADefault);
|
||||
Res:= JSReadString(Key, Def, AFileName);
|
||||
Result:= String(Res);
|
||||
end;
|
||||
function JSReadInteger (const AKey: UnicodeString; const ADefault: Int64; const AFileName: String): Int64; OVERLOAD;
|
||||
var JD: TJSONData;
|
||||
begin
|
||||
GetJSData(AFileName, JD);
|
||||
try
|
||||
Result:= JD.FindPath(FrmtKey(AKey)).AsInt64;
|
||||
except
|
||||
Result:= ADefault;
|
||||
end;
|
||||
JD.Free;
|
||||
end;
|
||||
function JSReadInteger (const AKey: String; const ADefault: Int64; const AFileName: String): Int64; OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
Result:= JSReadInteger(Key, ADefault, AFileName);
|
||||
end;
|
||||
function JSReadBoolean (const AKey: UnicodeString; const ADefault: Boolean; const AFileName: String): Boolean; OVERLOAD;
|
||||
var JD: TJSONData;
|
||||
begin
|
||||
GetJSData(AFileName, JD);
|
||||
try
|
||||
Result:= JD.FindPath(FrmtKey(AKey)).AsBoolean;
|
||||
except
|
||||
Result:= ADefault;
|
||||
end;
|
||||
JD.Free;
|
||||
end;
|
||||
function JSReadBoolean (const AKey: String; const ADefault: Boolean; const AFileName: String): Boolean; OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
Result:= JSReadBoolean(Key, ADefault, AFileName);
|
||||
end;
|
||||
function JSReadRGBColor (const AKey: UnicodeString; const ADefault: TRGBColor; const AFileName: String): TRGBColor; OVERLOAD;
|
||||
var JD: TJSONData;
|
||||
KeyM: UnicodeString;
|
||||
begin
|
||||
GetJSData(AFileName, JD);
|
||||
KeyM:= FrmtKey(AKey);
|
||||
try
|
||||
Result.R:= JD.FindPath(KeyM + '.r').AsInteger;
|
||||
Result.G:= JD.FindPath(KeyM + '.g').AsInteger;
|
||||
Result.B:= JD.FindPath(KeyM + '.b').AsInteger;
|
||||
except
|
||||
Result:= ADefault;
|
||||
end;
|
||||
JD.Free;
|
||||
end;
|
||||
function JSReadRGBColor (const AKey: String; const ADefault: TRGBColor; const AFileName: String): TRGBColor; OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
Result:= JSReadRGBColor(Key, ADefault, AFileName);
|
||||
end;
|
||||
procedure JSReadFont (const AKey: UnicodeString; var Font: TFont; const AFileName: String);
|
||||
var JD: TJSONData;
|
||||
FStyle: TFontStyles;
|
||||
KeyM: UnicodeString;
|
||||
begin
|
||||
GetJSData(AFileName, JD);
|
||||
KeyM:= FrmtKey(AKey);
|
||||
try
|
||||
Font.CharSet:= TFontCharSet(JD.FindPath(KeyM + '.charset').AsInteger);
|
||||
Font.Color:= StringToColor(JD.FindPath(KeyM + '.color').AsString);
|
||||
Font.Height:= JD.FindPath(KeyM + '.height').AsInteger;
|
||||
Font.Name:= JD.FindPath(KeyM + '.name').AsString;
|
||||
Font.Orientation:= JD.FindPath(KeyM + '.orientation').AsInteger;
|
||||
Font.Pitch:= TFontPitch(JD.FindPath(KeyM + '.pitch').AsInteger);
|
||||
Font.Quality:= TFontQuality(JD.FindPath(KeyM + '.quality').AsInteger);
|
||||
Font.Size:= JD.FindPath(KeyM + '.size').AsInteger;
|
||||
FStyle:= [];
|
||||
if (JD.FindPath(KeyM + '.style.bold').AsBoolean) then
|
||||
FStyle:= FStyle + [fsBold];
|
||||
if (JD.FindPath(KeyM + '.style.italic').AsBoolean) then
|
||||
FStyle:= FStyle + [fsItalic];
|
||||
if (JD.FindPath(KeyM + '.style.underline').AsBoolean) then
|
||||
FStyle:= FStyle + [fsUnderline];
|
||||
if (JD.FindPath(KeyM + '.style.strikeout').AsBoolean) then
|
||||
FStyle:= FStyle + [fsStrikeOut];
|
||||
Font.Style:= FStyle;
|
||||
except
|
||||
end;
|
||||
JD.Free;
|
||||
end;
|
||||
procedure JSReadFont (const AKey: String; var Font: TFont; const AFileName: String);
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
JSReadFont(Key, Font, AFileName);
|
||||
end;
|
||||
//Write procedures
|
||||
procedure JSWriteString (const AKey, AValue: UnicodeString; const AFileName: String); OVERLOAD;
|
||||
var JSConf: TJSONConfig;
|
||||
begin
|
||||
JSConf:= TJSONConfig.Create(Nil);
|
||||
with JSConf do
|
||||
begin
|
||||
Filename:= AFileName;
|
||||
Formatted:= True;
|
||||
SetValue(AKey, AValue);
|
||||
Flush;
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
procedure JSWriteString (const AKey, AValue, AFileName: String); OVERLOAD;
|
||||
var Key, Val: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
Val:= UnicodeString(AValue);
|
||||
JSWriteString(Key, Val, AFileName);
|
||||
end;
|
||||
procedure JSWriteInteger (const AKey: UnicodeString; const AValue: Int64; const AFileName: String); OVERLOAD;
|
||||
var JSConf: TJSONConfig;
|
||||
begin
|
||||
JSConf:= TJSONConfig.Create(Nil);
|
||||
with JSConf do
|
||||
begin
|
||||
Filename:= AFileName;
|
||||
Formatted:= True;
|
||||
SetValue(AKey, AValue);
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
procedure JSWriteInteger (const AKey: String; const AValue: Int64; const AFileName: String); OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
JSWriteInteger(Key, AValue, AFileName);
|
||||
end;
|
||||
procedure JSWriteBoolean (const AKey: UnicodeString; const AValue: Boolean; const AFileName: String); OVERLOAD;
|
||||
var JSConf: TJSONConfig;
|
||||
begin
|
||||
JSConf:= TJSONConfig.Create(Nil);
|
||||
with JSConf do
|
||||
begin
|
||||
Filename:= AFileName;
|
||||
Formatted:= True;
|
||||
SetValue(AKey, AValue);
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
procedure JSWriteBoolean (const AKey: String; const AValue: Boolean; const AFileName: String); OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
JSWriteBoolean(Key, AValue, AFileName);
|
||||
end;
|
||||
procedure JSWriteRGBColor (const AKey: UnicodeString; const AValue: TRGBColor; const AFileName: String); OVERLOAD;
|
||||
var JSConf: TJSONConfig;
|
||||
begin
|
||||
JSConf:= TJSONConfig.Create(Nil);
|
||||
with JSConf do
|
||||
begin
|
||||
Filename:= AFileName;
|
||||
Formatted:= True;
|
||||
SetValue(AKey + '/r', AValue.R);
|
||||
SetValue(AKey + '/g', AValue.G);
|
||||
SetValue(AKey + '/b', AValue.B);
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
procedure JSWriteRGBColor (const AKey: String; const AValue: TRGBColor; const AFileName: String); OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
JSWriteRGBColor(Key, AValue, AFileName);
|
||||
end;
|
||||
procedure JSWriteFont (const AKey: UnicodeString; const AValue: TFont; const AFileName: String); OVERLOAD;
|
||||
var JSConf: TJSONConfig;
|
||||
begin
|
||||
JSConf:= TJSONConfig.Create(Nil);
|
||||
with JSConf do
|
||||
begin
|
||||
Filename:= AFileName;
|
||||
Formatted:= True;
|
||||
SetValue(AKey + '/charset', Integer(AValue.CharSet));
|
||||
SetValue(AKey + '/color', ColorToString(AValue.Color));
|
||||
SetValue(AKey + '/height', AValue.Height);
|
||||
SetValue(AKey + '/name', AValue.Name);
|
||||
SetValue(AKey + '/orientation', AValue.Orientation);
|
||||
SetValue(AKey + '/pitch', Integer(AValue.Pitch));
|
||||
SetValue(AKey + '/quality', Integer(AValue.Quality));
|
||||
SetValue(AKey + '/size', AValue.Size);
|
||||
SetValue(AKey + '/style/bold', (fsBold in AValue.Style));
|
||||
SetValue(AKey + '/style/italic', (fsItalic in AValue.Style));
|
||||
SetValue(AKey + '/style/underline', (fsUnderline in AValue.Style));
|
||||
SetValue(AKey + '/style/strikeout', (fsStrikeOut in AValue.Style));
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
procedure JSWriteFont (const AKey: String; const AValue: TFont; const AFileName: String); OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
JSWriteFont(Key, AValue, AFileName);
|
||||
end;
|
||||
//Delete function
|
||||
procedure JSDeleteKey (const AKey: UnicodeString; const AFileName: String); OVERLOAD;
|
||||
var JSConf: TJSONConfig;
|
||||
begin
|
||||
JSConf:= TJSONConfig.Create(Nil);
|
||||
with JSConf do
|
||||
begin
|
||||
Filename:= AFileName;
|
||||
Formatted:= True;
|
||||
DeletePath(AKey);
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
procedure JSDeleteKey (const AKey, AFileName: String); OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
JSDeleteKey(Key, AFileName);
|
||||
end;
|
||||
//Read subkeys
|
||||
procedure JSReadSubKeys (const AKey: UnicodeString; SubkeyList: TStrings; const AFileName: String); OVERLOAD;
|
||||
var JSConf: TJSONConfig;
|
||||
begin
|
||||
JSConf:= TJSONConfig.Create(Nil);
|
||||
with JSConf do
|
||||
begin
|
||||
Filename:= AFileName;
|
||||
Formatted:= True;
|
||||
SubkeyList.Clear;
|
||||
EnumSubKeys(AKey, SubkeyList);
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
procedure JSReadSubKeys (const AKey: String; SubkeyList: TStrings; const AFileName: String); OVERLOAD;
|
||||
var Key: UnicodeString;
|
||||
begin
|
||||
Key:= UnicodeString(AKey);
|
||||
JSReadSubKeys(Key, SubkeyList, AFileName);
|
||||
end;
|
||||
end.
|
61
ANB ST CP/data/SkinButton.pas
Normal file
61
ANB ST CP/data/SkinButton.pas
Normal file
@@ -0,0 +1,61 @@
|
||||
unit SkinButton;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, Buttons, Graphics, Controls;
|
||||
type TSkinBtn = class(TSpeedButton)
|
||||
private
|
||||
FNormalColor, FHighlightColor, FClickColor: TColor;
|
||||
FTransparent: Boolean;
|
||||
FOnMouseDown: TMouseEvent;
|
||||
FOnMouseEnter, FOnMouseLeave: TNotifyEvent;
|
||||
protected
|
||||
procedure POnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure POnMouseEnter(Sender: TObject);
|
||||
procedure POnMouseLeave(Sender: TObject);
|
||||
public
|
||||
constructor Create(AOwner: TComponent);
|
||||
destructor Destroy;
|
||||
published
|
||||
property Transparent: Boolean read FTransparent;
|
||||
property NormalColor: TColor read FNormalColor write FNormalColor;
|
||||
property OnHighlightColor: TColor read FHighlightColor write FHighlightColor;
|
||||
property OnClickColor: TColor read FClickColor write FClickColor;
|
||||
property OnMouseDown: TMouseEvent read FOnMouseDown;
|
||||
property OnMouseEnter: TNotifyEvent read FOnMouseEnter;
|
||||
property OnMouseLeave: TNotifyEvent read FOnMouseLeave;
|
||||
end;
|
||||
implementation
|
||||
constructor TSkinBtn.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FNormalColor:= clWhite;
|
||||
FHighlightColor:= FNormalColor;
|
||||
FClickColor:= FNormalColor;
|
||||
FTransparent:= False;
|
||||
inherited Transparent:= FTransparent;
|
||||
inherited OnMouseEnter:= POnMouseEnter;
|
||||
inherited OnMouseDown:= POnMouseDown;
|
||||
inherited OnMouseLeave:= POnMouseLeave;
|
||||
end;
|
||||
destructor TSkinBtn.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
procedure TSkinBtn.POnMouseEnter(Sender: TObject);
|
||||
begin
|
||||
(Sender as TSkinBtn).Color:= FHighlightColor;
|
||||
inherited OnMouseEnter(Sender);
|
||||
end;
|
||||
procedure TSkinBtn.POnMouseLeave(Sender: TObject);
|
||||
begin
|
||||
(Sender as TSkinBtn).Color:= FNormalColor;
|
||||
inherited OnMouseLeave(Sender);
|
||||
end;
|
||||
procedure TSkinBtn.POnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if Button = mbLeft then
|
||||
(Sender as TSkinBtn).Color:= FClickColor;
|
||||
inherited OnMouseDown(Sender, Button, Shift, X, Y);
|
||||
end;
|
||||
end.
|
249
ANB ST CP/data/VCLEx.pas
Normal file
249
ANB ST CP/data/VCLEx.pas
Normal file
@@ -0,0 +1,249 @@
|
||||
unit VCLEx;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses ShellApi, windows, sysutils, strutils, LazFileUtils, LazUTF8;
|
||||
type IntEx = {$IFDEF Win64}Int64{$ELSE}Integer{$ENDIF};
|
||||
TWaitEvent = procedure;
|
||||
TOSPlatform = (ospUnknown, ospWin32, ospWin64);
|
||||
TPrivilegeState = (psError, psLimitedUser, psAdmin);
|
||||
Percent = 0..100;
|
||||
TRandomRange = (rrUpperCasesLetters, rrLowerCasesLetters, rrNumbers, rrStandartSymbols);
|
||||
TRandomRanges = set of TRandomRange;
|
||||
//stdcalls
|
||||
function IntToBool (const AInt: IntEx): Boolean; STDCALL;
|
||||
function BoolToInt (const ABool: Boolean): IntEx; STDCALL;
|
||||
function CopyDirectory (const AFromDir, AToDir: String; const AFlags: Word = FOF_FILESONLY): Boolean; STDCALL;
|
||||
function MoveDirectory (const AFromDir, AToDir: String; const AFlags: Word = FOF_FILESONLY): Boolean; STDCALL;
|
||||
function DelDirectory (const ADir: String; const AFlags: Word = FOF_SILENT or FOF_NOCONFIRMATION): Boolean; STDCALL;
|
||||
procedure WaitEx (const AMs: Int64; OnWait: TWaitEvent); STDCALL;
|
||||
procedure Wait (const AMs: Int64); STDCALL;
|
||||
function GetBuildPlatform: TOSPlatform; STDCALL;
|
||||
function GetWindowsUserPrivilege: TPrivilegeState; STDCALL;
|
||||
function ExtractUpDir(const ADir: String; var VSuccess: Boolean): String; STDCALL;
|
||||
function GetAnyFileType (const AFileName: UTF8String): UTF8String; STDCALL;
|
||||
function FileSizeToStr (const AFS: Int64; const AScaleCaptions: array of String): String; OVERLOAD; STDCALL;
|
||||
function FileSizeToStr (const AFS: Int64): String; OVERLOAD; STDCALL;
|
||||
function GetRandomString (const sLength: Integer; const ARange: TRandomRanges = [rrUpperCasesLetters, rrLowerCasesLetters]; const AIncludedSymbols: String = ''; const AExcludedSymbols: String = ''): String; STDCALL;
|
||||
implementation
|
||||
function IntToBool (const AInt: IntEx): Boolean;
|
||||
begin
|
||||
if AInt >= 0 then
|
||||
Result:= True
|
||||
else
|
||||
Result:= False;
|
||||
end;
|
||||
function BoolToInt (const ABool: Boolean): IntEx;
|
||||
begin
|
||||
if ABool then
|
||||
Result:= 1
|
||||
else
|
||||
Result:= -1;
|
||||
end;
|
||||
//from http://www.delphiworld.narod.ru/base/copy_del_move_dir.html
|
||||
function CopyDirectory (const AFromDir, AToDir: String; const AFlags: Word = FOF_FILESONLY): Boolean;
|
||||
var fos: TSHFileOpStruct;
|
||||
begin
|
||||
with fos do
|
||||
begin
|
||||
wFunc:= FO_COPY;
|
||||
fFlags:= AFlags;
|
||||
pFrom:= PChar(AFromDir + #0);
|
||||
pTo:= PChar(AToDir);
|
||||
end;
|
||||
Result:= (0 = SHFileOperation(fos));
|
||||
end;
|
||||
function MoveDirectory (const AFromDir, AToDir: String; const AFlags: Word = FOF_FILESONLY): Boolean;
|
||||
var fos: TSHFileOpStruct;
|
||||
begin
|
||||
with fos do
|
||||
begin
|
||||
wFunc:= FO_MOVE;
|
||||
fFlags:= AFlags;
|
||||
pFrom:= PChar(AFromDir + #0);
|
||||
pTo:= PChar(AToDir);
|
||||
end;
|
||||
Result:= (0 = SHFileOperation(fos));
|
||||
end;
|
||||
function DelDirectory (const ADir: String; const AFlags: Word = FOF_SILENT or FOF_NOCONFIRMATION): Boolean;
|
||||
var
|
||||
fos: TSHFileOpStruct;
|
||||
begin
|
||||
with fos do
|
||||
begin
|
||||
wFunc:= FO_DELETE;
|
||||
fFlags:= AFlags;
|
||||
pFrom:= PChar(ADir + #0);
|
||||
end;
|
||||
Result:= (0 = SHFileOperation(fos));
|
||||
end;
|
||||
//---
|
||||
procedure WaitEx (const AMs: Int64; OnWait: TWaitEvent);
|
||||
var STime: Int64;
|
||||
begin
|
||||
STime:= GetTickCount64;
|
||||
repeat
|
||||
OnWait;
|
||||
until (GetTickCount64 - STime) = AMs;
|
||||
end;
|
||||
procedure Wait (const AMs: Int64);
|
||||
procedure MyWait;
|
||||
begin
|
||||
end;
|
||||
begin
|
||||
WaitEx(AMs, @MyWait);
|
||||
end;
|
||||
//GetBuildPlatform
|
||||
function GetBuildPlatform: TOSPlatform;
|
||||
begin
|
||||
Result:= ospUnknown;
|
||||
if LowerCase({$I %FPCTARGETOS%}) = 'win32' then
|
||||
Result:= ospWin32;
|
||||
if LowerCase({$I %FPCTARGETOS%}) = 'win64' then
|
||||
Result:= ospWin64;
|
||||
end;
|
||||
//GetWindowsUserPrivilege
|
||||
function GetWindowsUserPrivilege: TPrivilegeState;
|
||||
const SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5));
|
||||
SECURITY_BUILTIN_DOMAIN_RID = $00000020;
|
||||
DOMAIN_ALIAS_RID_ADMINS = $00000220;
|
||||
SECURITY_MANDATORY_HIGH_RID = $00003000;
|
||||
TokenIntegrityLevel = 25;
|
||||
var hAccessToken: THandle;
|
||||
ptgGroups: PTokenGroups;
|
||||
dwInfoBufferSize: DWORD;
|
||||
psidAdministrators: PSID;
|
||||
I: Integer;
|
||||
SubAuthority: DWORD;
|
||||
begin
|
||||
Result:= psError;
|
||||
if Win32Platform <> VER_PLATFORM_WIN32_NT then
|
||||
Exit;
|
||||
if not OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True, hAccessToken) then
|
||||
if not OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, hAccessToken) then
|
||||
Exit;
|
||||
try
|
||||
GetMem(ptgGroups, 1024);
|
||||
try
|
||||
if Win32MajorVersion < 6 then
|
||||
begin
|
||||
if not GetTokenInformation(hAccessToken, TokenGroups, ptgGroups, 1024, dwInfoBufferSize) then
|
||||
Exit;
|
||||
AllocateAndInitializeSid(SECURITY_NT_AUTHORITY, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, psidAdministrators);
|
||||
try
|
||||
Result:= psLimitedUser;
|
||||
for I:= 0 to ptgGroups.GroupCount - 1 do
|
||||
if EqualSid(psidAdministrators, ptgGroups.Groups[I].Sid) then
|
||||
begin
|
||||
Result:= psAdmin;
|
||||
Break;
|
||||
end;
|
||||
finally
|
||||
FreeSid(psidAdministrators);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if GetTokenInformation(hAccessToken, TTokenInformationClass(TokenIntegrityLevel), ptgGroups, 1024, dwInfoBufferSize) and IsValidSid(PSIDAndAttributes(ptgGroups)^.Sid) then
|
||||
begin
|
||||
Result:= psLimitedUser;
|
||||
SubAuthority:= GetSidSubAuthorityCount(PSIDAndAttributes(ptgGroups)^.Sid)^ - 1;
|
||||
if GetSidSubAuthority(PSIDAndAttributes(ptgGroups)^.Sid, SubAuthority)^ >= SECURITY_MANDATORY_HIGH_RID then
|
||||
Result:= psAdmin;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
FreeMem(ptgGroups);
|
||||
end;
|
||||
finally
|
||||
CloseHandle(hAccessToken);
|
||||
end;
|
||||
end;
|
||||
function ExtractUpDir (const ADir: String; var VSuccess: Boolean): String;
|
||||
var CurrDelim, NextDelim: Integer;
|
||||
s, Str: String;
|
||||
begin
|
||||
Str:= ExcludeTrailingBackslash(ADir);
|
||||
if Length(ADir) < 4 then
|
||||
begin
|
||||
VSuccess:= false;
|
||||
Result:= ADir;
|
||||
Exit;
|
||||
end;
|
||||
s:= '';
|
||||
CurrDelim:= 1;
|
||||
repeat
|
||||
NextDelim:= PosEx('\', Str, CurrDelim);
|
||||
if NextDelim = 0 then
|
||||
NextDelim:= Length(Str) + 1;
|
||||
if NextDelim < Length(Str) then
|
||||
s:= s + Copy(Str, CurrDelim, NextDelim - CurrDelim) + '\';
|
||||
CurrDelim:= NextDelim + 1;
|
||||
until (CurrDelim > Length(Str));
|
||||
VSuccess:= DirectoryExistsUTF8(s);
|
||||
Result:= s;
|
||||
end;
|
||||
function GetAnyFileType (const AFileName: UTF8String): UTF8String;
|
||||
var FileInfo: TSHFILEINFO;
|
||||
begin
|
||||
Result:= '';
|
||||
FillChar(FileInfo, SizeOf(FileInfo), 0);
|
||||
if (SHGetFileInfo(PChar(ExtractFileExt(AFileName)), FILE_ATTRIBUTE_NORMAL, FileInfo, SizeOf(FileInfo), SHGFI_TYPENAME or SHGFI_USEFILEATTRIBUTES) <> 0) then
|
||||
Result:= AnsiToUtf8(FileInfo.szTypeName);
|
||||
end;
|
||||
function FileSizeToStr (const AFS: Int64; const AScaleCaptions: array of String): String;
|
||||
var ARSize: Real;
|
||||
begin
|
||||
if AFS < 1024 then
|
||||
begin
|
||||
Result:= Format('%d ' + AScaleCaptions[0], [AFS]);
|
||||
Exit;
|
||||
end;
|
||||
if AFS < 1048576 then
|
||||
begin
|
||||
ARSize:= Round((AFS / 1024)*100)/100;
|
||||
Result:= FloatToStr(ARSize) + ' ' + AScaleCaptions[1];
|
||||
Exit;
|
||||
end;
|
||||
if AFS < 1073741824 then
|
||||
begin
|
||||
ARSize:= Round((AFS / 1048576)*100)/100;
|
||||
Result:= FloatToStr(ARSize) + ' ' + AScaleCaptions[2];
|
||||
Exit;
|
||||
end;
|
||||
ARSize:= Round((AFS / 1073741824)*100)/100;
|
||||
Result:= FloatToStr(ARSize) + ' ' + AScaleCaptions[3];
|
||||
end;
|
||||
function FileSizeToStr (const AFS: Int64): String;
|
||||
begin
|
||||
Result:= FileSizeToStr(AFS, ['Byte', 'KB', 'MB', 'GB']);
|
||||
end;
|
||||
function GetRandomString (const sLength: Integer; const ARange: TRandomRanges = [rrUpperCasesLetters, rrLowerCasesLetters]; const AIncludedSymbols: String = ''; const AExcludedSymbols: String = ''): String;
|
||||
const UpperCaseChars = 'ABCDEFGHIKLMNOPQRSTUVWXYZ';
|
||||
LowerCaseChars = 'abcdefghiklmnopqrstuvwxyz';
|
||||
NumbersChars = '0123456789';
|
||||
SymbolsChars = '!"#$%&''()*+,-.:;<=>?@\]^_`{|}~';
|
||||
var i, j: Integer;
|
||||
Chars: String;
|
||||
begin
|
||||
SetLength (Result, sLength);
|
||||
Chars:= AIncludedSymbols;
|
||||
if rrUpperCasesLetters in ARange then
|
||||
Chars:= Chars + UpperCaseChars;
|
||||
if rrLowerCasesLetters in ARange then
|
||||
Chars:= Chars + LowerCaseChars;
|
||||
if rrNumbers in ARange then
|
||||
Chars:= Chars + NumbersChars;
|
||||
if rrStandartSymbols in ARange then
|
||||
Chars:= Chars + SymbolsChars;
|
||||
if Length(AExcludedSymbols) > 0 then
|
||||
for i:= 1 to Length(AExcludedSymbols) do
|
||||
begin
|
||||
j:= Pos(AExcludedSymbols[i], Chars);
|
||||
if j > 0 then
|
||||
Delete(Chars, j, 1);
|
||||
end;
|
||||
for i:= 1 to sLength do
|
||||
Result[i]:= Chars[Random(Length(Chars))+1];
|
||||
end;
|
||||
end.
|
145
ANB ST CP/data/VersionControl.pas
Normal file
145
ANB ST CP/data/VersionControl.pas
Normal file
@@ -0,0 +1,145 @@
|
||||
unit VersionControl;
|
||||
{$MODE Delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses LCLIntf, LCLType, LMessages, SysUtils, StrUtils, Forms, Classes,
|
||||
{$IFDEF WINDOWS}PJVersionInfo{$ENDIF};
|
||||
type TSmallVersionInfo = record
|
||||
sviMajor, sviMinor: int64;
|
||||
end;
|
||||
type TVersionInfo = record
|
||||
viMajor, viMinor, viRelease, viBuild: integer;
|
||||
end;
|
||||
function SmallVersionInfoToStr (const Value: TSmallVersionInfo): string; stdcall;
|
||||
function VersionInfoToStr (const Value: TVersionInfo): string; stdcall;
|
||||
function VersionInfoToSmallVersionInfo (const Value: TVersionInfo): TSmallVersionInfo; stdcall;
|
||||
function SmallVersionInfoToVersionInfo (const Value: TSmallVersionInfo; const ANilValue: integer = 0): TVersionInfo; stdcall;
|
||||
function StrToVersionInfo (const AString: string): TVersionInfo; stdcall;
|
||||
function StrToSmallVersionInfo (const AString: string): TSmallVersionInfo; stdcall;
|
||||
function CompareVersionInfo (const AVersionInfo1, AVersionInfo2: TVersionInfo): integer; stdcall;
|
||||
function CompareSmallVersionInfo (const ASmallVersionInfo1, ASmallVersionInfo2: TSmallVersionInfo): integer; stdcall;
|
||||
{$IFDEF WINDOWS}function GetApplicationVersionInfoStr (const AFileName, AVersionSTR: string): string; STDCALL;{$ENDIF}
|
||||
const NilVersionInfo: TVersionInfo = (viMajor: 0; viMinor: 0; viRelease: 0; viBuild: 0);
|
||||
NilSmallVersionInfo: TSmallVersionInfo = (sviMajor: 0; sviMinor: 0);
|
||||
implementation
|
||||
function SmallVersionInfoToStr (const Value: TSmallVersionInfo): string;
|
||||
const Mask: string = '%d.%d';
|
||||
begin
|
||||
Result:= Format(Mask, [Value.sviMajor, Value.sviMinor]);
|
||||
end;
|
||||
function VersionInfoToStr (const Value: TVersionInfo): string;
|
||||
const Mask: string = '%d.%d.%d.%d';
|
||||
begin
|
||||
Result:= Format(Mask, [Value.viMajor, Value.viMinor, Value.viRelease, Value.viBuild]);
|
||||
end;
|
||||
function VersionInfoToSmallVersionInfo (const Value: TVersionInfo): TSmallVersionInfo;
|
||||
begin
|
||||
Result.sviMajor:= Value.viMajor;
|
||||
Result.sviMinor:= Value.viMinor;
|
||||
end;
|
||||
function SmallVersionInfoToVersionInfo (const Value: TSmallVersionInfo; const ANilValue: integer = 0): TVersionInfo;
|
||||
begin
|
||||
Result.viMajor:= Value.sviMajor;
|
||||
Result.viMinor:= Value.sviMinor;
|
||||
Result.viRelease:= ANilValue;
|
||||
Result.viBuild:= ANilValue;
|
||||
end;
|
||||
function StrToVersionInfo (const AString: string): TVersionInfo;
|
||||
var stringver: string;
|
||||
CurrDelim, NextDelim, CurrIndex: Integer;
|
||||
StrArray: array [1..4] of string;
|
||||
begin
|
||||
stringver:= AString;
|
||||
CurrDelim:= 1;
|
||||
CurrIndex:= 1;
|
||||
repeat
|
||||
NextDelim:= PosEx('.', stringver, CurrDelim);
|
||||
if NextDelim = 0 then
|
||||
NextDelim:= Length(stringver) + 1;
|
||||
StrArray[CurrIndex]:= Copy(stringver, CurrDelim, NextDelim - CurrDelim);
|
||||
CurrDelim:= NextDelim + 1;
|
||||
CurrIndex:= CurrIndex + 1;
|
||||
until CurrDelim > Length(stringver);
|
||||
Result.viMajor:= StrToInt(StrArray[1]);
|
||||
Result.viMinor:= StrToInt(StrArray[2]);
|
||||
Result.viRelease:= StrToInt(StrArray[3]);
|
||||
Result.viBuild:= StrToInt(StrArray[4]);
|
||||
end;
|
||||
function StrToSmallVersionInfo (const AString: string): TSmallVersionInfo;
|
||||
var stringver: string;
|
||||
CurrDelim, NextDelim: Integer;
|
||||
StrArray: array [1..2] of string;
|
||||
begin
|
||||
stringver:= AString;
|
||||
NextDelim:= PosEx('.', stringver, 1);
|
||||
if NextDelim = 0 then
|
||||
begin
|
||||
StrArray[1]:= stringver;
|
||||
Exit;
|
||||
end;
|
||||
StrArray[1]:= Copy(stringver, 1, NextDelim - 1);
|
||||
CurrDelim:= NextDelim + 1;
|
||||
NextDelim:= PosEx('.', stringver, CurrDelim);
|
||||
if NextDelim = 0 then
|
||||
NextDelim:= Length(stringver) + 1;
|
||||
StrArray[2]:= Copy(stringver, CurrDelim, NextDelim - CurrDelim);
|
||||
Result.sviMajor:= StrToInt(StrArray[1]);
|
||||
Result.sviMinor:= StrToInt(StrArray[2]);
|
||||
end;
|
||||
function CompareVersionInfo (const AVersionInfo1, AVersionInfo2: TVersionInfo): integer;
|
||||
//Result:
|
||||
// 0 - AVersionInfo1 = AVersionInfo2
|
||||
// -1 - AVersionInfo1 > AVersionInfo2
|
||||
// 1 - AVersionInfo1 < AVersionInfo2
|
||||
begin
|
||||
//by default this versions are equal
|
||||
Result:= 0;
|
||||
//equal
|
||||
if ((AVersionInfo1.viMajor = AVersionInfo2.viMajor) and
|
||||
(AVersionInfo1.viMinor = AVersionInfo2.viMinor) and
|
||||
(AVersionInfo1.viRelease = AVersionInfo2.viRelease) and
|
||||
(AVersionInfo1.viBuild = AVersionInfo2.viBuild)) then
|
||||
Result:= 0;
|
||||
//more
|
||||
if ((AVersionInfo1.viMajor > AVersionInfo2.viMajor) or
|
||||
((AVersionInfo1.viMajor = AVersionInfo2.viMajor) and
|
||||
(AVersionInfo1.viMinor > AVersionInfo2.viMinor)) or
|
||||
((AVersionInfo1.viMajor = AVersionInfo2.viMajor) and
|
||||
(AVersionInfo1.viMinor = AVersionInfo2.viMinor) and
|
||||
(AVersionInfo1.viRelease > AVersionInfo2.viRelease)) or
|
||||
((AVersionInfo1.viMajor = AVersionInfo2.viMajor) and
|
||||
(AVersionInfo1.viMinor = AVersionInfo2.viMinor) and
|
||||
(AVersionInfo1.viRelease = AVersionInfo2.viRelease) and
|
||||
(AVersionInfo1.viBuild > AVersionInfo2.viBuild))) then
|
||||
Result:= -1;
|
||||
//less
|
||||
if ((AVersionInfo1.viMajor < AVersionInfo2.viMajor) or
|
||||
((AVersionInfo1.viMajor = AVersionInfo2.viMajor) and
|
||||
(AVersionInfo1.viMinor < AVersionInfo2.viMinor)) or
|
||||
((AVersionInfo1.viMajor = AVersionInfo2.viMajor) and
|
||||
(AVersionInfo1.viMinor = AVersionInfo2.viMinor) and
|
||||
(AVersionInfo1.viRelease < AVersionInfo2.viRelease)) or
|
||||
((AVersionInfo1.viMajor = AVersionInfo2.viMajor) and
|
||||
(AVersionInfo1.viMinor = AVersionInfo2.viMinor) and
|
||||
(AVersionInfo1.viRelease = AVersionInfo2.viRelease) and
|
||||
(AVersionInfo1.viBuild < AVersionInfo2.viBuild))) then
|
||||
Result:= 1;
|
||||
end;
|
||||
function CompareSmallVersionInfo (const ASmallVersionInfo1, ASmallVersionInfo2: TSmallVersionInfo): integer;
|
||||
var AVI1, AVI2: TVersionInfo;
|
||||
begin
|
||||
AVI1:= SmallVersionInfoToVersionInfo(ASmallVersionInfo1);
|
||||
AVI2:= SmallVersionInfoToVersionInfo(ASmallVersionInfo2);
|
||||
Result:= CompareVersionInfo(AVI1, AVI2);
|
||||
end;
|
||||
{$IFDEF WINDOWS}
|
||||
function GetApplicationVersionInfoStr (const AFileName, AVersionSTR: string): string;
|
||||
var VIC: TPJVersionInfo;
|
||||
begin
|
||||
VIC:= TPJVersionInfo.Create(nil);
|
||||
VIC.FileName:= AFileName;
|
||||
Result:= VIC.StringFileInfo[AVersionSTR];
|
||||
VIC.Free;
|
||||
end;
|
||||
{$ENDIF WINDOWS}
|
||||
end.
|
Reference in New Issue
Block a user