Changeset 55 for trunk/Packages


Ignore:
Timestamp:
Aug 23, 2012, 6:43:26 AM (12 years ago)
Author:
chronos
Message:
  • Modified: Update Common package.
Location:
trunk/Packages/Common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UCommon.pas

    r54 r55  
    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
  • trunk/Packages/Common/ULastOpenedList.pas

    r54 r55  
    2323    destructor Destroy; override;
    2424    procedure LoadToMenuItem(MenuItem: TMenuItem; ClickAction: TNotifyEvent);
    25     procedure LoadFromRegistry(Root: HKEY; Key: string);
    26     procedure SaveToRegistry(Root: HKEY; Key: string);
     25    procedure LoadFromRegistry(Context: TRegistryContext);
     26    procedure SaveToRegistry(Context: TRegistryContext);
    2727    procedure AddItem(FileName: string);
    2828  published
     
    8787end;
    8888
    89 procedure TLastOpenedList.LoadFromRegistry(Root: HKEY; Key: string);
     89procedure TLastOpenedList.LoadFromRegistry(Context: TRegistryContext);
    9090var
    9191  I: Integer;
     
    9696  with Registry do
    9797  try
    98     RootKey := Root;
    99     OpenKey(Key, True);
     98    RootKey := Context.RootKey;
     99    OpenKey(Context.Key, True);
    100100    Items.Clear;
    101101    I := 0;
     
    112112end;
    113113
    114 procedure TLastOpenedList.SaveToRegistry(Root: HKEY; Key: string);
     114procedure TLastOpenedList.SaveToRegistry(Context: TRegistryContext);
    115115var
    116116  I: Integer;
     
    120120  with Registry do
    121121  try
    122     RootKey := Root;
    123     OpenKey(Key, True);
     122    RootKey := Context.RootKey;
     123    OpenKey(Context.Key, True);
    124124    for I := 0 to Items.Count - 1 do
    125125      WriteString('File' + IntToStr(I), UTF8Decode(Items[I]));
  • trunk/Packages/Common/UMemory.pas

    r54 r55  
    2424    constructor Create;
    2525    destructor Destroy; override;
     26    procedure WriteMemory(Position: Integer; Memory: TMemory);
     27    procedure ReadMemory(Position: Integer; Memory: TMemory);
    2628    property Data: PByte read FData;
    2729    property Size: Integer read FSize write SetSize;
     
    108110end;
    109111
     112procedure TMemory.WriteMemory(Position: Integer; Memory: TMemory);
     113begin
     114  Move(Memory.FData, PByte(@FData + Position)^, Memory.Size);
     115end;
     116
     117procedure TMemory.ReadMemory(Position: Integer; Memory: TMemory);
     118begin
     119  Move(PByte(@FData + Position)^, Memory.FData, Memory.Size);
     120end;
     121
    110122end.
    111123
  • trunk/Packages/Common/URegistry.pas

    r54 r55  
    1717    rrKeyDynData = HKEY($80000006));
    1818
     19  TRegistryContext = record
     20    RootKey: HKEY;
     21    Key: string;
     22  end;
     23
    1924  { TRegistryEx }
    2025
     
    2934      DefaultValue: Double): Double;
    3035    function DeleteKeyRecursive(const Key: string): Boolean;
     36    function OpenKey(const Key: string; CanCreate: Boolean): Boolean;
    3137  end;
    3238
     39function RegContext(RootKey: HKEY; Key: string): TRegistryContext;
     40
     41
    3342implementation
     43
     44function RegContext(RootKey: HKEY; Key: string): TRegistryContext;
     45begin
     46  Result.RootKey := RootKey;
     47  Result.Key := Key;
     48end;
    3449
    3550{ TRegistryEx }
     
    8398end;
    8499
     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
    85108function TRegistryEx.ReadBoolWithDefault(const Name: string;
    86109  DefaultValue: Boolean): Boolean;
Note: See TracChangeset for help on using the changeset viewer.