- Changed versions to be read from the resource stream
This commit is contained in:
parent
de33600726
commit
4b5cf332ca
|
@ -19,7 +19,7 @@
|
||||||
<MinorVersionNr Value="6"/>
|
<MinorVersionNr Value="6"/>
|
||||||
<RevisionNr Value="1"/>
|
<RevisionNr Value="1"/>
|
||||||
<BuildNr Value="209"/>
|
<BuildNr Value="209"/>
|
||||||
<StringTable CompanyName="AKS DataBasis" FileDescription="UO CentrED" InternalName="CentrED" LegalCopyright="Andreas Schneider" OriginalFilename="CentrED.exe" ProductName="CentrED" ProductVersion=""/>
|
<StringTable CompanyName="AKS DataBasis" FileDescription="UO CentrED" InternalName="CentrED" LegalCopyright="Andreas Schneider" OriginalFilename="CentrED.exe" ProductName="CentrED" ProductVersion="0.6.1"/>
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
<BuildModes Count="3">
|
<BuildModes Count="3">
|
||||||
<Item1 Name="default" Default="True"/>
|
<Item1 Name="default" Default="True"/>
|
||||||
|
|
|
@ -12,11 +12,11 @@ object frmAbout: TfrmAbout
|
||||||
Font.Height = -11
|
Font.Height = -11
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.31'
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 53
|
Height = 53
|
||||||
Top = 189
|
Top = 178
|
||||||
Width = 338
|
Width = 338
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Top = 16
|
BorderSpacing.Top = 16
|
||||||
|
@ -28,7 +28,7 @@ object frmAbout: TfrmAbout
|
||||||
object Label5: TLabel
|
object Label5: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 14
|
Height = 14
|
||||||
Top = 98
|
Top = 87
|
||||||
Width = 338
|
Width = 338
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
|
@ -39,7 +39,7 @@ object frmAbout: TfrmAbout
|
||||||
object Label6: TLabel
|
object Label6: TLabel
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 53
|
Height = 53
|
||||||
Top = 112
|
Top = 101
|
||||||
Width = 330
|
Width = 330
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 16
|
BorderSpacing.Left = 16
|
||||||
|
@ -50,7 +50,7 @@ object frmAbout: TfrmAbout
|
||||||
object Label7: TLabel
|
object Label7: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 14
|
Height = 14
|
||||||
Top = 84
|
Top = 73
|
||||||
Width = 338
|
Width = 338
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Left = 8
|
BorderSpacing.Left = 8
|
||||||
|
@ -61,32 +61,32 @@ object frmAbout: TfrmAbout
|
||||||
end
|
end
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 76
|
Height = 65
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 354
|
Width = 354
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Bottom = 8
|
BorderSpacing.Bottom = 8
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 76
|
ClientHeight = 65
|
||||||
ClientWidth = 354
|
ClientWidth = 354
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 76
|
Height = 65
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 167
|
Width = 190
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BevelInner = bvRaised
|
BevelInner = bvRaised
|
||||||
BevelOuter = bvLowered
|
BevelOuter = bvLowered
|
||||||
ClientHeight = 76
|
ClientHeight = 65
|
||||||
ClientWidth = 167
|
ClientWidth = 190
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 38
|
Height = 38
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 163
|
Width = 186
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Alignment = taCenter
|
Alignment = taCenter
|
||||||
AutoSize = False
|
AutoSize = False
|
||||||
|
@ -99,9 +99,9 @@ object frmAbout: TfrmAbout
|
||||||
end
|
end
|
||||||
object lblVersion: TLabel
|
object lblVersion: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 14
|
Height = 1
|
||||||
Top = 40
|
Top = 40
|
||||||
Width = 155
|
Width = 178
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
BorderSpacing.Left = 4
|
BorderSpacing.Left = 4
|
||||||
|
@ -111,11 +111,12 @@ object frmAbout: TfrmAbout
|
||||||
object lblCopyright: TLabel
|
object lblCopyright: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 14
|
Height = 14
|
||||||
Top = 58
|
Top = 45
|
||||||
Width = 155
|
Width = 178
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Alignment = taCenter
|
Alignment = taCenter
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
|
Caption = 'Copyright 2011 Andreas Schneider'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -123,7 +124,7 @@ object frmAbout: TfrmAbout
|
||||||
object Panel3: TPanel
|
object Panel3: TPanel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 250
|
Top = 239
|
||||||
Width = 338
|
Width = 338
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Around = 8
|
BorderSpacing.Around = 8
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2007 Andreas Schneider
|
* Portions Copyright 2011 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
unit UfrmAbout;
|
unit UfrmAbout;
|
||||||
|
|
||||||
|
@ -62,7 +62,8 @@ var
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$I version.inc}
|
uses
|
||||||
|
vinfo;
|
||||||
|
|
||||||
{ TfrmAbout }
|
{ TfrmAbout }
|
||||||
|
|
||||||
|
@ -73,8 +74,7 @@ end;
|
||||||
|
|
||||||
procedure TfrmAbout.FormCreate(Sender: TObject);
|
procedure TfrmAbout.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
lblVersion.Caption := Format('Version %s', [ProductVersion]);
|
lblVersion.Caption := Format('Version %s', [VersionInfo.GetProductVersionString]);
|
||||||
lblCopyright.Caption := Format('Copyright %s', [Copyright]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<MinorVersionNr Value="6"/>
|
<MinorVersionNr Value="6"/>
|
||||||
<RevisionNr Value="1"/>
|
<RevisionNr Value="1"/>
|
||||||
<BuildNr Value="209"/>
|
<BuildNr Value="209"/>
|
||||||
<StringTable CompanyName="AKS DataBasis" FileDescription="CentrED Server" InternalName="CentrED Server" LegalCopyright="Andreas Schneider" OriginalFilename="cedserver.exe" ProductName="CentrED"/>
|
<StringTable CompanyName="AKS DataBasis" FileDescription="CentrED Server" InternalName="CentrED Server" LegalCopyright="Andreas Schneider" OriginalFilename="cedserver.exe" ProductName="CentrED" ProductVersion="0.6.1"/>
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
<BuildModes Count="3">
|
<BuildModes Count="3">
|
||||||
<Item1 Name="default" Default="True"/>
|
<Item1 Name="default" Default="True"/>
|
||||||
|
@ -219,7 +219,6 @@
|
||||||
<IncludeFiles Value="..;../Imaging"/>
|
<IncludeFiles Value="..;../Imaging"/>
|
||||||
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging/ZLib"/>
|
<OtherUnitFiles Value="..;../UOLib;../MulProvider;../Imaging/ZLib"/>
|
||||||
<UnitOutputDirectory Value="../obj"/>
|
<UnitOutputDirectory Value="../obj"/>
|
||||||
<SrcPath Value="..;../UOLib;../MulProvider;../Imaging/ZLib"/>
|
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
<SyntaxOptions>
|
<SyntaxOptions>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright 2008 Andreas Schneider
|
* Portions Copyright 2011 Andreas Schneider
|
||||||
*)
|
*)
|
||||||
program cedserver;
|
program cedserver;
|
||||||
|
|
||||||
|
@ -31,18 +31,14 @@ uses
|
||||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
SysUtils, UConfig, UCEDServer;
|
SysUtils, UConfig, UCEDServer, vinfo;
|
||||||
|
|
||||||
{$I version.inc}
|
|
||||||
|
|
||||||
{$IFDEF WINDOWS}{$R cedserver.rc}{$ENDIF}
|
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln('');
|
Writeln('');
|
||||||
Writeln('CentrED Server Version ', ProductVersion);
|
Writeln('CentrED Server Version ', versionInfo.GetProductVersionString);
|
||||||
Writeln('Copyright ', Copyright);
|
Writeln('Copyright 2011 Andreas Schneider');
|
||||||
//Writeln('================================');
|
//Writeln('================================');
|
||||||
Writeln('');
|
Writeln('');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
unit vinfo;
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, resource, versiontypes, versionresource;
|
||||||
|
|
||||||
|
type
|
||||||
|
TVersionPrecision = 1..4;
|
||||||
|
|
||||||
|
{ TVersionInfo }
|
||||||
|
|
||||||
|
TVersionInfo = class
|
||||||
|
private
|
||||||
|
FVersResource: TVersionResource;
|
||||||
|
function GetFixedInfo: TVersionFixedInfo;
|
||||||
|
function GetStringFileInfo: TVersionStringFileInfo;
|
||||||
|
function GetVarFileInfo: TVersionVarFileInfo;
|
||||||
|
public
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
procedure Load(Instance: THandle);
|
||||||
|
property FixedInfo: TVersionFixedInfo read GetFixedInfo;
|
||||||
|
property StringFileInfo: TVersionStringFileInfo read GetStringFileInfo;
|
||||||
|
property VarFileInfo: TVersionVarFileInfo read GetVarFileInfo;
|
||||||
|
|
||||||
|
//Helper functions
|
||||||
|
function GetProductVersionString(AMinPrecision: TVersionPrecision = 2): String;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
VersionInfo: TVersionInfo;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TVersionInfo }
|
||||||
|
|
||||||
|
function TVersionInfo.GetFixedInfo: TVersionFixedInfo;
|
||||||
|
begin
|
||||||
|
Result := FVersResource.FixedInfo;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TVersionInfo.GetStringFileInfo: TVersionStringFileInfo;
|
||||||
|
begin
|
||||||
|
Result := FVersResource.StringFileInfo;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TVersionInfo.GetVarFileInfo: TVersionVarFileInfo;
|
||||||
|
begin
|
||||||
|
Result := FVersResource.VarFileInfo;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TVersionInfo.Create;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FVersResource := TVersionResource.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TVersionInfo.Destroy;
|
||||||
|
begin
|
||||||
|
FVersResource.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TVersionInfo.Load(Instance: THandle);
|
||||||
|
var
|
||||||
|
Stream: TResourceStream;
|
||||||
|
begin
|
||||||
|
Stream := TResourceStream.CreateFromID(Instance, 1, PChar(RT_VERSION));
|
||||||
|
try
|
||||||
|
FVersResource.SetCustomRawDataStream(Stream);
|
||||||
|
// access some property to load from the stream
|
||||||
|
FVersResource.FixedInfo;
|
||||||
|
// clear the stream
|
||||||
|
FVersResource.SetCustomRawDataStream(nil);
|
||||||
|
finally
|
||||||
|
Stream.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TVersionInfo.GetProductVersionString(AMinPrecision: TVersionPrecision = 2): String;
|
||||||
|
var
|
||||||
|
productVersion: TFileProductVersion;
|
||||||
|
lastVersion, i: Integer;
|
||||||
|
begin
|
||||||
|
productVersion := FixedInfo.ProductVersion;
|
||||||
|
lastVersion := 3;
|
||||||
|
while (lastVersion >= AMinPrecision) and (productVersion[lastVersion] = 0) do
|
||||||
|
dec(lastVersion);
|
||||||
|
|
||||||
|
Result := '';
|
||||||
|
for i := 0 to lastVersion do
|
||||||
|
begin
|
||||||
|
Result := Result + IntToStr(productVersion[i]);
|
||||||
|
if i < lastVersion then
|
||||||
|
Result := Result + '.';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
VersionInfo := TVersionInfo.Create;
|
||||||
|
VersionInfo.Load(HINSTANCE);
|
||||||
|
|
||||||
|
finalization
|
||||||
|
VersionInfo.Free;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue