Changeset 52 for trunk/UCore.pas
- Timestamp:
- Jul 26, 2012, 3:11:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r51 r52 7 7 uses 8 8 Classes, SysUtils, FileUtil, UApplicationInfo, ULastOpenedList, 9 UCoolTranslator, UTarget ;9 UCoolTranslator, UTarget, URegistry, Registry; 10 10 11 11 type … … 25 25 Targets: TTargetList; 26 26 OpenProjectOnStart: Boolean; 27 procedure LoadFromRegistry(Root: HKEY; Key: string); 28 procedure SaveToRegistry(Root: HKEY; Key: string); 27 29 end; 28 30 … … 48 50 Targets.Add(TTargetC.Create); 49 51 Targets.Add(TTargetJava.Create); 52 LoadFromRegistry(HKEY(ApplicationInfo.RegistryRoot), ApplicationInfo.RegistryKey); 50 53 end; 51 54 52 55 procedure TCore.DataModuleDestroy(Sender: TObject); 53 56 begin 57 SaveToRegistry(HKEY(ApplicationInfo.RegistryRoot), ApplicationInfo.RegistryKey); 54 58 Targets.Free; 59 end; 60 61 procedure TCore.LoadFromRegistry(Root: HKEY; Key: string); 62 var 63 TargetName: string; 64 begin 65 with TRegistryEx.Create do 66 try 67 RootKey := Root; 68 OpenKey(Key, True); 69 OpenProjectOnStart := ReadBoolWithDefault('OpenProjectOnStart', True); 70 if ValueExists('LanguageCode') then 71 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')) 72 else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(''); 73 finally 74 Free; 75 end; 76 LastOpenedList.LoadFromRegistry(Root, Key); 77 Targets.LoadFromRegistry(Root, Key); 78 end; 79 80 procedure TCore.SaveToRegistry(Root: HKEY; Key: string); 81 begin 82 Targets.SaveToRegistry(Root, Key); 83 LastOpenedList.SaveToRegistry(Root, Key); 84 with TRegistryEx.Create do 85 try 86 RootKey := Root; 87 OpenKey(Key, True); 88 WriteBool('OpenProjectOnStart', OpenProjectOnStart); 89 if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then 90 WriteString('LanguageCode', CoolTranslator1.Language.Code) 91 else DeleteValue('LanguageCode'); 92 finally 93 Free; 94 end; 55 95 end; 56 96
Note:
See TracChangeset
for help on using the changeset viewer.