Changeset 404


Ignore:
Timestamp:
Aug 13, 2012, 10:03:31 AM (12 years ago)
Author:
chronos
Message:
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Common/UCommon.pas

    r364 r404  
    77uses
    88  {$IFDEF Windows}Windows,{$ENDIF}
    9   Classes, SysUtils, StrUtils, Dialogs, Process,
     9  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf,
    1010  FileUtil; //, ShFolder, ShellAPI;
    1111
     
    404404  Browser, Params: string;
    405405begin
    406   try
     406  OpenURL(URL);
     407  {try
    407408    Process := TProcess.Create(nil);
    408409    Browser := '';
     
    415416  finally
    416417    Process.Free;
    417   end;
     418  end;}
    418419end;
    419420
  • Common/URegistry.pas

    r400 r404  
    3434      DefaultValue: Double): Double;
    3535    function DeleteKeyRecursive(const Key: string): Boolean;
     36    function OpenKey(const Key: string; CanCreate: Boolean): Boolean;
    3637  end;
    3738
     
    9798end;
    9899
     100function TRegistryEx.OpenKey(const Key: string; CanCreate: Boolean): Boolean;
     101begin
     102  {$IFDEF Linux}
     103  CloseKey;
     104  {$ENDIF}
     105  Result := inherited OpenKey(Key, CanCreate);
     106end;
     107
    99108function TRegistryEx.ReadBoolWithDefault(const Name: string;
    100109  DefaultValue: Boolean): Boolean;
  • ModularSystem/UModularSystem.pas

    r401 r404  
    5959    Modules: TObjectList; // TObjectList<TModule>
    6060    function FindModuleByName(Name: string): TModule;
    61     procedure InstallDependencies(Dependencies: TStringList);
     61    procedure InstallDependencies(ModuleName: string; Dependencies: TStringList);
    6262    procedure UninstallDependencies(ModuleName: string);
    6363    procedure EnumModulesInstall(Dependencies, ModuleList: TStringList);
     
    7878
    7979resourcestring
    80   SModuleNotFound = 'Module %s not found';
     80  SModuleNotFound = 'Module "%1:s" not found as dependency for module "%0:s"';
    8181
    8282procedure Register;
     
    107107end;
    108108
    109 procedure TModuleManager.InstallDependencies(Dependencies: TStringList);
     109procedure TModuleManager.InstallDependencies(ModuleName: string; Dependencies: TStringList);
    110110var
    111111  Module: TModule;
     
    116116    if Assigned(Module) then begin
    117117      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]]);
    119119  end;
    120120end;
     
    218218begin
    219219  if Installed then Exit;
    220   Manager.InstallDependencies(Dependencies);
     220  Manager.InstallDependencies(Identification, Dependencies);
    221221  FInstalled := True;
    222222end;
  • PinConnection/USerialPort.pas

    r283 r404  
    77uses
    88  Classes, SysUtils, SynaSer, StdCtrls, Dialogs, UCommon, UThreading,
    9   DateUtils;
     9  DateUtils, FileUtil;
    1010
    1111type
     
    7474    property BaudRateNumeric: Integer read GetBaudRateNumeric write SetBaudRateNumeric;
    7575    property OnReceiveData: TReceiveDataEvent read FOnReceiveData write FOnReceiveData;
     76    procedure LoadAvailableToStrings(Strings: TStrings; Check: Boolean = False);
    7677    constructor Create;
    7778    destructor Destroy; override;
     
    169170  FreeAndNil(FReceiveThread);
    170171  CloseSocket;
     172end;
     173
     174procedure TSerialPort.LoadAvailableToStrings(Strings: TStrings; Check: Boolean = False);
     175var
     176  I: Integer;
     177  TestPort: TSerialPort;
     178  Files: TStringList;
     179begin
     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}
    171211end;
    172212
  • UpdateChecker/UUpdateChecker.pas

    r379 r404  
    66
    77uses
    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,
    99  FileUtil, Dialogs, Process, Blcksock, UFormDownloadProgress;
    1010
     
    2929    function DownloadHTTP(URL, TargetFile: string): Boolean;
    3030    function InstallerFileName: string;
    31     function IsWindowsAdmin: Boolean;
     31    function IsSystemAdmin: Boolean;
    3232    procedure SockStatus(Sender: TObject; Reason: THookSocketReason;
    3333    const Value: String);
     
    5858implementation
    5959
     60{$IFDEF Windows}
    6061const
    6162  SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5)) ;
     
    6465  SECURITY_BUILTIN_DOMAIN_RID = $00000020;
    6566  DOMAIN_ALIAS_RID_ADMINS = $00000220;
     67{$ENDIF}
    6668
    6769procedure Register;
     
    145147begin
    146148  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)
    150160    else
    151161    try
     
    232242end;
    233243
    234 function TUpdateChecker.IsWindowsAdmin: Boolean;
     244{$IFDEF Windows}
     245function TUpdateChecker.IsSystemAdmin: Boolean;
    235246var
    236247  hAccessToken: THandle;
     
    242253begin
    243254  Result := False;
    244 
    245255  bSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True, hAccessToken) ;
    246256  if not bSuccess then
     
    276286  end;
    277287end;
     288{$ELSE}
     289function TUpdateChecker.IsSystemAdmin: Boolean;
     290begin
     291  Result := False;
     292end;
     293
     294{$ENDIF}
    278295
    279296procedure TUpdateChecker.SockStatus(Sender: TObject; Reason: THookSocketReason;
Note: See TracChangeset for help on using the changeset viewer.