47 lines
2.0 KiB
ObjectPascal
47 lines
2.0 KiB
ObjectPascal
unit cde_kernel;
|
|
{$mode delphi}
|
|
{$codepage UTF8}
|
|
interface
|
|
uses LazFileUtils, sysutils, cde_dir, SimplyJSON, VersionControl, windows, Forms, FileUtilsEx, cde_lang;
|
|
{stdcalls}
|
|
function GetCDEVer (const AProgramName: String): TVersionInfo; STDCALL;
|
|
function GetCDEVerStr (const AProgramName: String): String; STDCALL;
|
|
function ShowMessageBox (const AText: String; const AMessageType: LongInt; const AMessageBtns: LongInt = 0): Integer; STDCALL;
|
|
function CDEFileSize2Str (const AFS: Int64; const AShowInBytes: Boolean): String; STDCALL;
|
|
implementation
|
|
//Versions
|
|
//Исполльзуйте в роли AProgramName следующее:
|
|
// package -- версия сборки;
|
|
// dll -- версия cdejecter.dll;
|
|
// cde -- версия оболочки командной строки;
|
|
// cdeg -- версия GUI-приложения.
|
|
function GetCDEVer (const AProgramName: String): TVersionInfo;
|
|
begin
|
|
Result:= StrToVersionInfo(JSReadString('/' + AProgramName + '/version', '0.0.0.0', GetCDEPath + 'configs\version.json'));
|
|
end;
|
|
function GetCDEVerStr (const AProgramName: String): String;
|
|
begin
|
|
Result:= JSReadString('/' + AProgramName + '/string', '0.0.0.0', GetCDEPath + 'configs\version.json');
|
|
end;
|
|
//MessageBoxes
|
|
function ShowMessageBox (const AText: String; const AMessageType: LongInt; const AMessageBtns: LongInt = 0): Integer;
|
|
begin
|
|
MessageBeep(AMessageType);
|
|
Result:= Application.MessageBox(PChar(AText), PChar(Application.Title), AMessageType + AMessageBtns);
|
|
end;
|
|
//FileSize2Str
|
|
function CDEFileSize2Str (const AFS: Int64; const AShowInBytes: Boolean): String;
|
|
begin
|
|
if AShowInBytes then
|
|
Result:= IntToStr(AFS) + ' ' + GetLocalizedString(filesizes_byte)
|
|
else
|
|
Result:= FileSize2Str(AFS, [
|
|
GetLocalizedString(filesizes_byte),
|
|
GetLocalizedString(filesizes_kilobyte),
|
|
GetLocalizedString(filesizes_megabyte),
|
|
GetLocalizedString(filesizes_gigabyte),
|
|
GetLocalizedString(filesizes_terabyte)
|
|
]);
|
|
end;
|
|
end.
|