Ignore:
Timestamp:
Dec 17, 2016, 6:33:13 PM (8 years ago)
Author:
chronos
Message:
  • Added: Main application icon.
  • Modified: Updated Command and CoolTranslator packages.
  • Added: About dialog.
File:
1 edited

Legend:

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

    r73 r74  
    66
    77uses
    8   {$IFDEF Windows}Windows,{$ENDIF}
     8  {$ifdef Windows}Windows,{$endif}
     9  {$ifdef Linux}baseunix,{$endif}
    910  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf,
    1011  FileUtil; //, ShFolder, ShellAPI;
     
    6970function GetDirCount(Dir: string): Integer;
    7071function MergeArray(A, B: array of string): TArrayOfString;
     72function LoadFileToStr(const FileName: TFileName): AnsiString;
    7173
    7274
     
    305307  end;
    306308end;
     309{$endif}
    307310
    308311function ComputerName: string;
     
    324327{$endif}
    325328{$ifdef unix}
    326 begin
    327   Result := GetHostName;
     329var
     330  Name: UtsName;
     331begin
     332  fpuname(Name);
     333  Result := Name.Nodename;
    328334end;
    329335{$endif}
    330336
     337{$ifdef windows}
    331338function LoggedOnUserNameEx(Format: TUserNameFormat): string;
    332339const
     
    443450
    444451procedure OpenWebPage(URL: string);
    445 var
    446   Process: TProcess;
    447   Browser, Params: string;
    448452begin
    449453  OpenURL(URL);
    450   {try
    451     Process := TProcess.Create(nil);
    452     Browser := '';
    453     //FindDefaultBrowser(Browser, Params);
    454     //Process.Executable := Browser;
    455     //Process.Parameters.Add(Format(Params, [ApplicationInfo.HomePage]);
    456     Process.CommandLine := 'cmd.exe /c start ' + URL;
    457     Process.Options := [poNoConsole];
    458     Process.Execute;
    459   finally
    460     Process.Free;
    461   end;}
    462454end;
    463455
     
    501493end;
    502494
     495function LoadFileToStr(const FileName: TFileName): AnsiString;
     496var
     497  FileStream: TFileStream;
     498  Read: Integer;
     499begin
     500  Result := '';
     501  FileStream := TFileStream.Create(FileName, fmOpenRead);
     502  try
     503    if FileStream.Size > 0 then begin
     504      SetLength(Result, FileStream.Size);
     505      Read := FileStream.Read(Pointer(Result)^, FileStream.Size);
     506      SetLength(Result, Read);
     507    end;
     508  finally
     509    FileStream.Free;
     510  end;
     511end;
     512
    503513
    504514
Note: See TracChangeset for help on using the changeset viewer.