Changeset 63 for trunk/Modules
- Timestamp:
- Dec 19, 2011, 12:58:50 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 2 2 bin 3 3 lib 4 Config.ini
-
- Property svn:ignore
-
trunk/Modules/UMainModule.pas
r62 r63 7 7 uses 8 8 Classes, SysUtils, FileUtil, LResources, UHTTPServerCGI, UHTTPSessionMySQL, 9 UHTTPServer, USqlDatabase, URegistry, DateUtils, UWebPage, UWebApp,9 UHTTPServer, USqlDatabase, INIFiles, DateUtils, UWebPage, UWebApp, 10 10 UXmlClasses, UHtmlClasses, UCore, UHTTPServerTCP, 11 11 UHTTPSessionFile, UUser, SpecializedList, Registry; 12 13 const 14 ConfigFile = 'Config.ini'; 12 15 13 16 type … … 115 118 UserOnline := TWebOnlineUser.Create; 116 119 UserOnline.Database := Database; 120 LoadFromRegistry; 117 121 end; 118 122 119 123 destructor TMainModule.Destroy; 120 124 begin 125 SaveToRegistry; 121 126 HtmlDocument.Free; 122 127 User.Free; … … 229 234 230 235 procedure TMainModule.LoadFromRegistry; 231 begin 232 with TRegistryEx.Create do 236 const 237 SectionGeneral = 'General'; 238 SectionDatabase = 'Database'; 239 begin 240 with TIniFile.Create(ConfigFile) do 233 241 try 234 RootKey := HKEY_CURRENT_USER;235 OpenKey(ApplicationInfo.RegistryKey, True);236 Style := ReadString WithDefault('Style', 'Basic');237 BaseURL := ReadString WithDefault('BaseURL', 'http://localhost');238 Database.Hostname := ReadString WithDefault('DatabaseHostName', 'localhost');239 Database.Database := ReadString WithDefault('DatabaseDatabase', 'web');240 Database.UserName := ReadString WithDefault('DatabaseUserName', 'user');241 Database.Password := ReadString WithDefault('DatabasePassword', 'password');242 FormatHTML := ReadBool WithDefault('FormatHTML', False);243 Application.LogException := not ReadBool WithDefault('ShowException', False);242 //RootKey := HKEY_CURRENT_USER; 243 //OpenKey(ApplicationInfo.RegistryKey, True); 244 Style := ReadString(SectionGeneral, 'Style', 'Basic'); 245 BaseURL := ReadString(SectionGeneral, 'BaseURL', 'http://localhost'); 246 Database.Hostname := ReadString(SectionDatabase, 'DatabaseHostName', 'localhost'); 247 Database.Database := ReadString(SectionDatabase, 'DatabaseDatabase', 'web'); 248 Database.UserName := ReadString(SectionDatabase, 'DatabaseUserName', 'user'); 249 Database.Password := ReadString(SectionDatabase, 'DatabasePassword', 'password'); 250 FormatHTML := ReadBool(SectionGeneral, 'FormatHTML', False); 251 Application.LogException := not ReadBool(SectionGeneral, 'ShowException', False); 244 252 finally 245 253 Free; … … 248 256 249 257 procedure TMainModule.SaveToRegistry; 250 begin 251 258 const 259 SectionGeneral = 'General'; 260 SectionDatabase = 'Database'; 261 begin 262 with TIniFile.Create(ConfigFile) do 263 try 264 //RootKey := HKEY_CURRENT_USER; 265 //OpenKey(ApplicationInfo.RegistryKey, True); 266 WriteString(SectionGeneral, 'Style', Style); 267 WriteString(SectionGeneral, 'BaseURL', BaseURL); 268 WriteString(SectionDatabase, 'DatabaseHostName', Database.Hostname); 269 WriteString(SectionDatabase, 'DatabaseDatabase', Database.Database); 270 WriteString(SectionDatabase, 'DatabaseUserName', Database.UserName); 271 WriteString(SectionDatabase, 'DatabasePassword', Database.Password); 272 WriteBool(SectionGeneral, 'FormatHTML', FormatHTML); 273 WriteBool(SectionGeneral, 'ShowException', not Application.LogException); 274 finally 275 Free; 276 end; 252 277 end; 253 278 254 279 procedure TMainModule.Run; 255 280 begin 256 LoadFromRegistry;257 281 InitDatabase; 258 282 //Database.Query('SELECT * FROM ssss');
Note:
See TracChangeset
for help on using the changeset viewer.