Changeset 399
- Timestamp:
- Aug 7, 2012, 2:43:10 PM (12 years ago)
- Location:
- ModularSystem
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ModularSystem/ModularSystem.lpk
r394 r399 9 9 <PathDelim Value="\"/> 10 10 <SearchPaths> 11 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) \"/>11 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 12 12 </SearchPaths> 13 13 <Other> … … 24 24 <Item1> 25 25 <Filename Value="UModularSystem.pas"/> 26 <HasRegisterProc Value="True"/> 26 27 <UnitName Value="UModularSystem"/> 27 28 </Item1> -
ModularSystem/ModularSystem.pas
r394 r399 14 14 procedure Register; 15 15 begin 16 RegisterUnit('UModularSystem', @UModularSystem.Register); 16 17 end; 17 18 -
ModularSystem/UModularSystem.pas
r397 r399 11 11 TModuleManager = class; 12 12 13 TAPI = class 13 TAPI = class(TComponent) 14 14 15 15 end; … … 17 17 { TModule } 18 18 19 TModule = class 19 TModule = class(TComponent) 20 20 private 21 21 FInstalled: Boolean; 22 22 Manager: TModuleManager; 23 FVersion: string; 24 FIdentification: string; 25 FTitle: string; 26 FLicense: string; 27 FAuthor: string; 28 FDependencies: TStringList; 29 FDescription: TStringList; 23 30 procedure SetInstalled(AValue: Boolean); 24 31 public 25 Version: string;26 Name: string;27 Title: string;28 Dependencies: TStringList;29 Author: string;30 Description: TStringList;31 License: string;32 32 API: TAPI; 33 33 MarkForInstall: Boolean; … … 40 40 destructor Destroy; override; 41 41 property Installed: Boolean read FInstalled write SetInstalled; 42 published 43 property Version: string read FVersion write FVersion; 44 property Identification: string read FIdentification write FIdentification; 45 property Title: string read FTitle write FTitle; 46 property License: string read FLicense write FLicense; 47 property Author: string read FAuthor write FAuthor; 48 property Dependencies: TStringList read FDependencies write FDependencies; 49 property Description: TStringList read FDescription write FDescription; 42 50 end; 43 51 … … 64 72 end; 65 73 74 procedure Register; 75 66 76 67 77 implementation … … 70 80 SModuleNotFound = 'Module %s not found'; 71 81 82 procedure Register; 83 begin 84 RegisterComponents('ModularSystem', [TModuleManager, TModule]); 85 end; 86 72 87 { TModuleManager } 73 88 … … 87 102 begin 88 103 I := 0; 89 while (I < Modules.Count) and (TModule(Modules[I]). Name<> Name) do Inc(I);104 while (I < Modules.Count) and (TModule(Modules[I]).Identification <> Name) do Inc(I); 90 105 if I < Modules.Count then Result := TModule(Modules[I]) 91 106 else Result := nil; … … 101 116 if Assigned(Module) then begin 102 117 if not Module.Installed then Module.Install; 103 end else raise Exception.CreateFmt(SModuleNotFound, [Module. Name]);118 end else raise Exception.CreateFmt(SModuleNotFound, [Module.Identification]); 104 119 end; 105 120 end; … … 111 126 for I := 0 to Modules.Count - 1 do 112 127 with TModule(Modules[I]) do begin 113 if Dependencies.IndexOf(ModuleName) <> - 1then Uninstall;128 if (Dependencies.IndexOf(ModuleName) <> - 1) and Installed then Uninstall; 114 129 end; 115 130 end; … … 124 139 Module := FindModuleByName(Dependencies[I]); 125 140 if Assigned(Module) then begin 126 if not Module.Installed and (ModuleList.IndexOf(Module. Name) = -1) then begin127 ModuleList.Add(Module. Name);141 if not Module.Installed and (ModuleList.IndexOf(Module.Identification) = -1) then begin 142 ModuleList.Add(Module.Identification); 128 143 EnumModulesInstall(Module.Dependencies, ModuleList); 129 144 end; 130 end else raise Exception.CreateFmt(SModuleNotFound, [Module. Name]);145 end else raise Exception.CreateFmt(SModuleNotFound, [Module.Identification]); 131 146 end; 132 147 end; … … 140 155 with TModule(Modules[I]) do begin 141 156 if (Dependencies.IndexOf(ModuleName) <> -1) and Installed and 142 (ModuleList.IndexOf( Name) = -1) then begin143 ModuleList.Add( Name);144 Self.EnumModulesUninstall( Name, ModuleList);157 (ModuleList.IndexOf(Identification) = -1) then begin 158 ModuleList.Add(Identification); 159 Self.EnumModulesUninstall(Identification, ModuleList); 145 160 end; 146 161 end; … … 210 225 begin 211 226 if not Installed then Exit; 212 Manager.UninstallDependencies( Name);227 Manager.UninstallDependencies(Identification); 213 228 FInstalled := False; 214 229 end; … … 228 243 begin 229 244 ModuleList.Clear; 230 Manager.EnumModulesUninstall( Name, ModuleList);245 Manager.EnumModulesUninstall(Identification, ModuleList); 231 246 end; 232 247
Note:
See TracChangeset
for help on using the changeset viewer.