Skip to content

Commit

Permalink
Opraveno ziskavani build datetime.
Browse files Browse the repository at this point in the history
  • Loading branch information
horacekj committed Apr 16, 2017
1 parent 81438cf commit 0e9e163
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 76 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Panel for hJOP.
## Special components & libraries

- [DelphiX](http://www.micrel.cz/Dx/) 1.12.x
- [JEDI Code Library](http://wiki.delphi-jedi.org/index.php?title=JEDI_Code_Library)

## Resource file

Expand Down
79 changes: 5 additions & 74 deletions src/Verze.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,14 @@

interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Menus, ImgList, Buttons,
ComCtrls,inifiles, ActnList, AppEvnts, Mask, ScktComp,ToolWin,jpeg,
Spin, ExtDlgs, Grids, Gauges, Registry,
StrUtils, DateUtils, mmsystem;
uses Windows, SysUtils, Forms, jclPEImage;

function NactiVerzi(const FileName: string): string;//cteni verze z nastaveni
function GetZkrVersion(const FileName: string):String;
function GetUpdateVersion(const FileName: string):String;
function GetLastBuildDate:string;
function GetLastBuildTime:string;

var MyMsg:Cardinal;
Mutex:THandle;

implementation

uses fMain;

function NactiVerzi(const FileName: string): string;//cteni verze z nastaveni
var
size, len: longword;
Expand All @@ -45,72 +34,14 @@ function NactiVerzi(const FileName: string): string;//cteni verze z nastaveni
end;
end;

function GetZkrVersion(const FileName:String):String;
var
size, len: longword;
handle: THandle;
buffer: pchar;
pinfo: ^VS_FIXEDFILEINFO;
Major, Minor, Release: word;
begin
Result:='Není dostupná';
size := GetFileVersionInfoSize(Pointer(FileName), handle);
if size > 0 then begin
GetMem(buffer, size);
if GetFileVersionInfo(Pointer(FileName), 0, size, buffer)
then
if VerQueryValue(buffer, '\', pointer(pinfo), len) then begin
Major := HiWord(pinfo.dwFileVersionMS);
Minor := LoWord(pinfo.dwFileVersionMS);
Release := HiWord(pinfo.dwFileVersionLS);
Result := Format('%d%d%d',[Major, Minor, Release]);
end;
FreeMem(buffer);
end;
end;//function

function GetUpdateVersion(const FileName:String):String;
var
size, len: longword;
handle: THandle;
buffer: pchar;
pinfo: ^VS_FIXEDFILEINFO;
Major, Minor, Release: word;
begin
Result:='Není dostupná';
size := GetFileVersionInfoSize(Pointer(FileName), handle);
if size > 0 then begin
GetMem(buffer, size);
if GetFileVersionInfo(Pointer(FileName), 0, size, buffer)
then
if VerQueryValue(buffer, '\', pointer(pinfo), len) then begin
Major := HiWord(pinfo.dwFileVersionMS);
Minor := LoWord(pinfo.dwFileVersionMS);
Release := HiWord(pinfo.dwFileVersionLS);
Result := IntToStr((Major shl 16)+(Minor shl 8)+(Release));
end;
FreeMem(buffer);
end;
end;//function

function GetLastBuildDate:String;
var lSearchRec: TSearchRec;
function GetLastBuildDate():String;
begin
if (FindFirst(Application.EXEName, faAnyFile, lSearchRec) = 0) then
begin
DateTimeToString(Result,'dd.mm.yyyy',FileDateToDateTime(lSearchRec.Time));
FindClose(lSearchRec);
end;
DateTimeToString(Result, 'dd.mm.yyyy', jclPEImage.PeReadLinkerTimeStamp(Application.ExeName));
end;//function

function GetLastBuildTime:String;
var lSearchRec: TSearchRec;
function GetLastBuildTime():String;
begin
if (FindFirst(Application.EXEName, faAnyFile, lSearchRec) = 0) then
begin
DateTimeToString(Result,'hh:mm:ss',FileDateToDateTime(lSearchRec.Time));
FindClose(lSearchRec);
end;
DateTimeToString(Result, 'hh:mm:ss', jclPEImage.PeReadLinkerTimeStamp(Application.ExeName));
end;//function

end.//unit
4 changes: 2 additions & 2 deletions src/hJOPpanel.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
<VersionInfo Name="AutoIncBuild">True</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">4</VersionInfo>
<VersionInfo Name="Release">7</VersionInfo>
<VersionInfo Name="Release">8</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
Expand All @@ -179,7 +179,7 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription">Panel stanice hJOP</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.4.7.0</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.4.8.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName">hJOPpanel.exe</VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright">Jan Horáček</VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks">Jan Horáček</VersionInfoKeys>
Expand Down

0 comments on commit 0e9e163

Please sign in to comment.