source: trunk/UCore.pas

Last change on this file was 41, checked in by chronos, 5 years ago
  • Modified: Build under Lazarus 2.0.
  • Modified: Used .lrj files instead of .lrt files.
  • Modified: Removed TemplateGenerics package.
File size: 1.6 KB
Line 
1unit UCore;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, XMLConf, FileUtil, Controls, UProject, UPhysDrive,
9 UCoolTranslator, UPersistentForm, UApplicationInfo, URegistry, UScaleDPI,
10 Registry;
11
12type
13
14 { TCore }
15
16 TCore = class(TDataModule)
17 ApplicationInfo1: TApplicationInfo;
18 CoolTranslator1: TCoolTranslator;
19 ImageList1: TImageList;
20 PersistentForm1: TPersistentForm;
21 ScaleDPI1: TScaleDPI;
22 XMLConfig1: TXMLConfig;
23 procedure DataModuleCreate(Sender: TObject);
24 procedure DataModuleDestroy(Sender: TObject);
25 private
26 RegistryContext: TRegistryContext;
27 public
28 DevelMode: Boolean;
29 DriveList: TDriveList;
30 Project: TProject;
31 procedure LoadConfig;
32 procedure SaveConfig;
33 end;
34
35var
36 Core: TCore;
37
38implementation
39
40{$R *.lfm}
41
42{ TCore }
43
44procedure TCore.DataModuleCreate(Sender: TObject);
45begin
46 DriveList := TDriveList.Create;
47 Project := nil;
48 XMLConfig1.Filename := 'config.xml';
49 Randomize;
50end;
51
52procedure TCore.DataModuleDestroy(Sender: TObject);
53begin
54 if Assigned(Project) then FreeAndNil(Project);
55 FreeAndNil(DriveList);
56end;
57
58procedure TCore.LoadConfig;
59begin
60 RegistryContext := TRegistryContext.Create(ApplicationInfo1.RegistryRoot, ApplicationInfo1.RegistryKey);
61 PersistentForm1.RegistryContext := RegistryContext;
62 XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml';
63 ForceDirectories(ExtractFileDir(XMLConfig1.Filename));
64
65 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(string(XMLConfig1.GetValue('Language', unicodestring(''))));
66end;
67
68procedure TCore.SaveConfig;
69begin
70 XMLConfig1.SetValue('Language', UnicodeString(CoolTranslator1.Language.Code));
71end;
72
73end.
74
Note: See TracBrowser for help on using the repository browser.