Графический интерфейс в aria2c RPC http://blindage.org/?p=5385
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vinfo.pas 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. unit vinfo;
  2. {$mode objfpc}
  3. interface
  4. uses
  5. Classes, SysUtils, resource, versiontypes, versionresource;
  6. type
  7. { TVersionInfo }
  8. TVersionInfo = class
  9. private
  10. FVersResource: TVersionResource;
  11. function GetFixedInfo: TVersionFixedInfo;
  12. function GetStringFileInfo: TVersionStringFileInfo;
  13. function GetVarFileInfo: TVersionVarFileInfo;
  14. public
  15. constructor Create;
  16. destructor Destroy; override;
  17. procedure Load(Instance: THandle);
  18. property FixedInfo: TVersionFixedInfo read GetFixedInfo;
  19. property StringFileInfo: TVersionStringFileInfo read GetStringFileInfo;
  20. property VarFileInfo: TVersionVarFileInfo read GetVarFileInfo;
  21. end;
  22. implementation
  23. { TVersionInfo }
  24. function TVersionInfo.GetFixedInfo: TVersionFixedInfo;
  25. begin
  26. Result := FVersResource.FixedInfo;
  27. end;
  28. function TVersionInfo.GetStringFileInfo: TVersionStringFileInfo;
  29. begin
  30. Result := FVersResource.StringFileInfo;
  31. end;
  32. function TVersionInfo.GetVarFileInfo: TVersionVarFileInfo;
  33. begin
  34. Result := FVersResource.VarFileInfo;
  35. end;
  36. constructor TVersionInfo.Create;
  37. begin
  38. inherited Create;
  39. FVersResource := TVersionResource.Create;
  40. end;
  41. destructor TVersionInfo.Destroy;
  42. begin
  43. FVersResource.Free;
  44. inherited Destroy;
  45. end;
  46. procedure TVersionInfo.Load(Instance: THandle);
  47. var
  48. Stream: TResourceStream;
  49. begin
  50. Stream := TResourceStream.CreateFromID(Instance, 1, PChar(RT_VERSION));
  51. try
  52. FVersResource.SetCustomRawDataStream(Stream);
  53. // access some property to load from the stream
  54. FVersResource.FixedInfo;
  55. // clear the stream
  56. FVersResource.SetCustomRawDataStream(nil);
  57. finally
  58. Stream.Free;
  59. end;
  60. end;
  61. end.