Ignore:
Timestamp:
Nov 16, 2012, 9:59:56 AM (12 years ago)
Author:
chronos
Message:
  • Fixed: Store module settings in system registry.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/ModularSystem/UModularSystem.pas

    r56 r59  
    109109    FAPI: TAPI;
    110110    FOnUpdate: TNotifyEvent;
    111     FUpdateCount: Integer;
    112111    FOptions: TModuleManagerOptions;
    113112    procedure SetAPI(AValue: TAPI);
     
    122121    procedure RegisterModule(Module: TModule);
    123122    procedure UnregisterModule(Module: TModule);
    124     procedure LoadFromRegistry(Context: TRegistryContext);
    125     procedure SaveToRegistry(Context: TRegistryContext);
     123    procedure LoadFromRegistry(AContext: TRegistryContext);
     124    procedure SaveToRegistry(AContext: TRegistryContext);
    126125    constructor Create(AOwner: TComponent); override;
    127126    destructor Destroy; override;
     
    139138resourcestring
    140139  SModuleNotFound = 'Module "%1:s" not found as dependency for module "%0:s"';
     140  SInvalidModuleName = 'Invalid module name';
    141141
    142142procedure Register;
     
    264264procedure TModuleManager.RegisterModule(Module: TModule);
    265265begin
     266  if Module.Identification = '' then
     267    raise Exception.Create(SInvalidModuleName);
    266268  Modules.Add(Module);
    267269  Module.FManager := Self;
     
    291293end;
    292294
    293 procedure TModuleManager.LoadFromRegistry(Context: TRegistryContext);
     295procedure TModuleManager.LoadFromRegistry(AContext: TRegistryContext);
    294296var
    295297  I: Integer;
     
    297299  with TRegistryEx.Create do
    298300  try
    299     RootKey := Context.RootKey;
     301    RootKey := AContext.RootKey;
    300302    for I := 0 to Modules.Count - 1 do
    301303    with TModule(Modules[I]) do begin
    302       OpenKey(Context.Key + '\' + Identification, True);
     304      OpenKey(AContext.Key + '\' + Identification, True);
    303305      Installed := ReadBoolWithDefault('Installed', Installed);
    304306      Enabled := ReadBoolWithDefault('Enabled', Enabled);
     
    309311end;
    310312
    311 procedure TModuleManager.SaveToRegistry(Context: TRegistryContext);
     313procedure TModuleManager.SaveToRegistry(AContext: TRegistryContext);
    312314var
    313315  I: Integer;
     
    315317  with TRegistryEx.Create do
    316318  try
    317     RootKey := Context.RootKey;
     319    RootKey := AContext.RootKey;
    318320    for I := 0 to Modules.Count - 1 do
    319321    with TModule(Modules[I]) do begin
    320       OpenKey(Context.Key + '\' + Identification, True);
     322      OpenKey(AContext.Key + '\' + Identification, True);
    321323      WriteBool('Enabled', Enabled);
    322324      WriteBool('Installed', Installed);
Note: See TracChangeset for help on using the changeset viewer.