source: trunk/Packages/Common/UApplicationInfo.pas

Last change on this file was 18, checked in by chronos, 12 years ago
  • Used external packages are now stored in uncompressed form rather in zipped files. This allow better package version synchronisation.
File size: 2.5 KB
Line 
1unit UApplicationInfo;
2
3{$mode delphi}
4
5interface
6
7uses
8 SysUtils, Registry, Classes, Forms, URegistry;
9
10type
11
12 { TApplicationInfo }
13
14 TApplicationInfo = class(TComponent)
15 private
16 FIdentification: Byte;
17 FVersionMajor: Byte;
18 FVersionMinor: Byte;
19 FVersionBugFix: Byte;
20 FVersionSuffix: string; // alfa, beta, RC1, RC2, ...
21 FCompanyName: string;
22 FCompanyHomePage: string;
23 FHomePage: string;
24 FAuthorsName: string;
25 FEmailContact: string;
26 FAppName: string;
27 FReleaseDate: TDateTime;
28 FRegistryKey: string;
29 FRegistryRoot: TRegistryRoot;
30 function GetVersion: string;
31 public
32 constructor Create(AOwner: TComponent); override;
33 property Version: string read GetVersion;
34 published
35 property Identification: Byte read FIdentification write FIdentification;
36 property VersionMajor: Byte read FVersionMajor write FVersionMajor;
37 property VersionMinor: Byte read FVersionMinor write FVersionMinor;
38 property VersionBugFix: Byte read FVersionBugFix write FVersionBugFix;
39 property VersionSuffix: string read FVersionSuffix write FVersionSuffix;
40 property CompanyName: string read FCompanyName write FCompanyName;
41 property CompanyHomePage: string read FCompanyHomePage write FCompanyHomePage;
42 property HomePage: string read FHomePage write FHomePage;
43 property AuthorsName: string read FAuthorsName write FAuthorsName;
44 property EmailContact: string read FEmailContact write FEmailContact;
45 property AppName: string read FAppName write FAppName;
46 property ReleaseDate: TDateTime read FReleaseDate write FReleaseDate;
47 property RegistryKey: string read FRegistryKey write FRegistryKey;
48 property RegistryRoot: TRegistryRoot read FRegistryRoot write FRegistryRoot;
49 end;
50
51procedure Register;
52
53implementation
54
55procedure Register;
56begin
57 RegisterComponents('Samples', [TApplicationInfo]);
58end;
59
60{ TApplicationInfo }
61
62function TApplicationInfo.GetVersion: string;
63begin
64 Result := IntToStr(FVersionMajor) + '.' + IntToStr(FVersionMinor);
65 if FVersionSuffix <> '' then Result := Result + ' ' + FVersionSuffix
66 else Result := Result + '.' + IntToStr(FVersionBugFix);
67end;
68
69constructor TApplicationInfo.Create(AOwner: TComponent);
70begin
71 inherited Create(AOwner);
72 FVersionMajor := 1;
73 FIdentification := 1;
74 FAppName := Application.Name;
75 FRegistryKey := '\Software\' + FAppName;
76 FRegistryRoot := rrKeyCurrentUser;
77end;
78
79end.
Note: See TracBrowser for help on using the repository browser.