Changeset 404
- Timestamp:
- Aug 13, 2012, 10:03:31 AM (12 years ago)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UCommon.pas
r364 r404 7 7 uses 8 8 {$IFDEF Windows}Windows,{$ENDIF} 9 Classes, SysUtils, StrUtils, Dialogs, Process, 9 Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, 10 10 FileUtil; //, ShFolder, ShellAPI; 11 11 … … 404 404 Browser, Params: string; 405 405 begin 406 try 406 OpenURL(URL); 407 {try 407 408 Process := TProcess.Create(nil); 408 409 Browser := ''; … … 415 416 finally 416 417 Process.Free; 417 end; 418 end;} 418 419 end; 419 420 -
Common/URegistry.pas
r400 r404 34 34 DefaultValue: Double): Double; 35 35 function DeleteKeyRecursive(const Key: string): Boolean; 36 function OpenKey(const Key: string; CanCreate: Boolean): Boolean; 36 37 end; 37 38 … … 97 98 end; 98 99 100 function TRegistryEx.OpenKey(const Key: string; CanCreate: Boolean): Boolean; 101 begin 102 {$IFDEF Linux} 103 CloseKey; 104 {$ENDIF} 105 Result := inherited OpenKey(Key, CanCreate); 106 end; 107 99 108 function TRegistryEx.ReadBoolWithDefault(const Name: string; 100 109 DefaultValue: Boolean): Boolean; -
ModularSystem/UModularSystem.pas
r401 r404 59 59 Modules: TObjectList; // TObjectList<TModule> 60 60 function FindModuleByName(Name: string): TModule; 61 procedure InstallDependencies( Dependencies: TStringList);61 procedure InstallDependencies(ModuleName: string; Dependencies: TStringList); 62 62 procedure UninstallDependencies(ModuleName: string); 63 63 procedure EnumModulesInstall(Dependencies, ModuleList: TStringList); … … 78 78 79 79 resourcestring 80 SModuleNotFound = 'Module %s not found';80 SModuleNotFound = 'Module "%1:s" not found as dependency for module "%0:s"'; 81 81 82 82 procedure Register; … … 107 107 end; 108 108 109 procedure TModuleManager.InstallDependencies( Dependencies: TStringList);109 procedure TModuleManager.InstallDependencies(ModuleName: string; Dependencies: TStringList); 110 110 var 111 111 Module: TModule; … … 116 116 if Assigned(Module) then begin 117 117 if not Module.Installed then Module.Install; 118 end else raise Exception.CreateFmt(SModuleNotFound, [ Dependencies[I]]);118 end else raise Exception.CreateFmt(SModuleNotFound, [ModuleName, Dependencies[I]]); 119 119 end; 120 120 end; … … 218 218 begin 219 219 if Installed then Exit; 220 Manager.InstallDependencies( Dependencies);220 Manager.InstallDependencies(Identification, Dependencies); 221 221 FInstalled := True; 222 222 end; -
PinConnection/USerialPort.pas
r283 r404 7 7 uses 8 8 Classes, SysUtils, SynaSer, StdCtrls, Dialogs, UCommon, UThreading, 9 DateUtils ;9 DateUtils, FileUtil; 10 10 11 11 type … … 74 74 property BaudRateNumeric: Integer read GetBaudRateNumeric write SetBaudRateNumeric; 75 75 property OnReceiveData: TReceiveDataEvent read FOnReceiveData write FOnReceiveData; 76 procedure LoadAvailableToStrings(Strings: TStrings; Check: Boolean = False); 76 77 constructor Create; 77 78 destructor Destroy; override; … … 169 170 FreeAndNil(FReceiveThread); 170 171 CloseSocket; 172 end; 173 174 procedure TSerialPort.LoadAvailableToStrings(Strings: TStrings; Check: Boolean = False); 175 var 176 I: Integer; 177 TestPort: TSerialPort; 178 Files: TStringList; 179 begin 180 Strings.Clear; 181 {$IFDEF Windows} 182 if Check then 183 try 184 TestPort := TSerialPort.Create; 185 for I := 0 to Strings.Count - 1 do 186 with TestPort do begin 187 Name := Strings[I]; 188 Active := True; 189 if Active then begin 190 Strings.AddObject(Name, TObject(I)); 191 end; 192 Active := False; 193 end; 194 finally 195 TestPort.Free; 196 end else begin 197 for I := 1 to 255 do 198 Strings.AddObject('COM' + IntToStr(I), nil); 199 end; 200 {$ENDIF} 201 {$IFDEF Linux} 202 if Check then begin 203 Files := FindAllFiles('/dev', 'tty*', False); 204 Strings.Assign(Files); 205 Files.Free; 206 end else begin 207 for I := 1 to 63 do 208 Strings.AddObject('/dev/ttyS' + IntToStr(I), nil); 209 end; 210 {$ENDIF} 171 211 end; 172 212 -
UpdateChecker/UUpdateChecker.pas
r379 r404 6 6 7 7 uses 8 Windows, ShellApi,Forms, Classes, SysUtils, httpsend, DOM, XMLWrite, XMLRead, UXMLUtils,8 {$IFDEF Windows}Windows, ShellApi, {$ENDIF}Forms, Classes, SysUtils, httpsend, DOM, XMLWrite, XMLRead, UXMLUtils, 9 9 FileUtil, Dialogs, Process, Blcksock, UFormDownloadProgress; 10 10 … … 29 29 function DownloadHTTP(URL, TargetFile: string): Boolean; 30 30 function InstallerFileName: string; 31 function Is WindowsAdmin: Boolean;31 function IsSystemAdmin: Boolean; 32 32 procedure SockStatus(Sender: TObject; Reason: THookSocketReason; 33 33 const Value: String); … … 58 58 implementation 59 59 60 {$IFDEF Windows} 60 61 const 61 62 SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5)) ; … … 64 65 SECURITY_BUILTIN_DOMAIN_RID = $00000020; 65 66 DOMAIN_ALIAS_RID_ADMINS = $00000220; 67 {$ENDIF} 66 68 67 69 procedure Register; … … 145 147 begin 146 148 if FileExistsUTF8(InstallerFileName) then begin 147 if not IsWindowsAdmin then 148 ShellExecute(0, PChar('runas'), PChar(InstallerFileName), 149 0, 0, SW_SHOWNORMAL) 149 if not IsSystemAdmin then 150 try 151 Process := TProcess.Create(nil); 152 Process.CommandLine := 'runas ' + InstallerFileName; 153 Process.Options := Process.Options + []; 154 Process.Execute; 155 finally 156 Process.Free; 157 end 158 //ShellExecute(0, PChar('runas'), PChar(InstallerFileName), 159 // 0, 0, SW_SHOWNORMAL) 150 160 else 151 161 try … … 232 242 end; 233 243 234 function TUpdateChecker.IsWindowsAdmin: Boolean; 244 {$IFDEF Windows} 245 function TUpdateChecker.IsSystemAdmin: Boolean; 235 246 var 236 247 hAccessToken: THandle; … … 242 253 begin 243 254 Result := False; 244 245 255 bSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True, hAccessToken) ; 246 256 if not bSuccess then … … 276 286 end; 277 287 end; 288 {$ELSE} 289 function TUpdateChecker.IsSystemAdmin: Boolean; 290 begin 291 Result := False; 292 end; 293 294 {$ENDIF} 278 295 279 296 procedure TUpdateChecker.SockStatus(Sender: TObject; Reason: THookSocketReason;
Note:
See TracChangeset
for help on using the changeset viewer.