source: trunk/Packages/Common/UApplicationInfo.pas

Last change on this file was 1, checked in by chronos, 8 years ago
  • Imported initial version.
File size: 2.6 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 FLicense: string;
18 FVersionMajor: Byte;
19 FVersionMinor: Byte;
20 FVersionBugFix: Byte;
21 FVersionSuffix: string; // alfa, beta, RC1, RC2, ...
22 FCompanyName: string;
23 FCompanyHomePage: string;
24 FHomePage: string;
25 FAuthorsName: string;
26 FEmailContact: string;
27 FAppName: string;
28 FReleaseDate: TDateTime;
29 FRegistryKey: string;
30 FRegistryRoot: TRegistryRoot;
31 function GetVersion: string;
32 public
33 constructor Create(AOwner: TComponent); override;
34 property Version: string read GetVersion;
35 published
36 property Identification: Byte read FIdentification write FIdentification;
37 property VersionMajor: Byte read FVersionMajor write FVersionMajor;
38 property VersionMinor: Byte read FVersionMinor write FVersionMinor;
39 property VersionBugFix: Byte read FVersionBugFix write FVersionBugFix;
40 property VersionSuffix: string read FVersionSuffix write FVersionSuffix;
41 property CompanyName: string read FCompanyName write FCompanyName;
42 property CompanyHomePage: string read FCompanyHomePage write FCompanyHomePage;
43 property HomePage: string read FHomePage write FHomePage;
44 property AuthorsName: string read FAuthorsName write FAuthorsName;
45 property EmailContact: string read FEmailContact write FEmailContact;
46 property AppName: string read FAppName write FAppName;
47 property ReleaseDate: TDateTime read FReleaseDate write FReleaseDate;
48 property RegistryKey: string read FRegistryKey write FRegistryKey;
49 property RegistryRoot: TRegistryRoot read FRegistryRoot write FRegistryRoot;
50 property License: string read FLicense write FLicense;
51 end;
52
53procedure Register;
54
55implementation
56
57procedure Register;
58begin
59 RegisterComponents('Common', [TApplicationInfo]);
60end;
61
62{ TApplicationInfo }
63
64function TApplicationInfo.GetVersion: string;
65begin
66 Result := IntToStr(FVersionMajor) + '.' + IntToStr(FVersionMinor);
67 if FVersionSuffix <> '' then Result := Result + ' ' + FVersionSuffix
68 else Result := Result + '.' + IntToStr(FVersionBugFix);
69end;
70
71constructor TApplicationInfo.Create(AOwner: TComponent);
72begin
73 inherited Create(AOwner);
74 FVersionMajor := 1;
75 FIdentification := 1;
76 FAppName := Application.Name;
77 FRegistryKey := '\Software\' + FAppName;
78 FRegistryRoot := rrKeyCurrentUser;
79end;
80
81end.
Note: See TracBrowser for help on using the repository browser.