1 | unit UApplicationInfo;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | SysUtils, Registry, Classes, Forms, URegistry;
|
---|
9 |
|
---|
10 | type
|
---|
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 |
|
---|
53 | procedure Register;
|
---|
54 |
|
---|
55 | implementation
|
---|
56 |
|
---|
57 | procedure Register;
|
---|
58 | begin
|
---|
59 | RegisterComponents('Common', [TApplicationInfo]);
|
---|
60 | end;
|
---|
61 |
|
---|
62 | { TApplicationInfo }
|
---|
63 |
|
---|
64 | function TApplicationInfo.GetVersion: string;
|
---|
65 | begin
|
---|
66 | Result := IntToStr(FVersionMajor) + '.' + IntToStr(FVersionMinor);
|
---|
67 | if FVersionSuffix <> '' then Result := Result + ' ' + FVersionSuffix
|
---|
68 | else Result := Result + '.' + IntToStr(FVersionBugFix);
|
---|
69 | end;
|
---|
70 |
|
---|
71 | constructor TApplicationInfo.Create(AOwner: TComponent);
|
---|
72 | begin
|
---|
73 | inherited Create(AOwner);
|
---|
74 | FVersionMajor := 1;
|
---|
75 | FIdentification := 1;
|
---|
76 | FAppName := Application.Name;
|
---|
77 | FRegistryKey := '\Software\' + FAppName;
|
---|
78 | FRegistryRoot := rrKeyCurrentUser;
|
---|
79 | end;
|
---|
80 |
|
---|
81 | end.
|
---|