Frage

Wie kann man in Delphi (XE2 bis XE5) programmgesteuert eine Zielplattform zu einem Projekt hinzufügen?

Mit „programmgesteuert“ meine ich über die OpenTools-API, im Gegensatz zu einer Transformation der .dproj-Datei.Dies muss in einem IDE-Assistenten/Experten erfolgen.

Ich habe mir die ToolsAPI-Einheit angesehen und es scheint, dass Sie die aktive Plattform und die Liste der unterstützten Plattformen erhalten können, aber es gibt nichts Offensichtliches für das Hinzufügen einer neuen Zielplattform.

War es hilfreich?

Lösung

Es scheint, dass dies möglich ist.Die Einheit, in der Sie suchen müssen, ist PlatformAPI.Die Schnittstelle, die alles hat, was Sie brauchen, ist:

  { Provides information on platform-specific information held by a project }
  IOTAProjectPlatforms160 = interface(IInterface)
    ['{E1C62726-BD51-4D4E-A2F2-9A8A59F272AE}']
    { Add an available platform to the project }
    procedure AddPlatform(const PlatformName: string);
    { Return the currently active platform key }
    function CurrentPlatform: string;
    { Return enabled state of the requested platform }
    function GetEnabled(const PlatformName: string): Boolean;
    { Return an array of strings representing the enabled platforms for a project }
    function GetEnabledPlatforms: TArray<string>;
    { Return the profile name associated with the specified platform }
    function GetProfile(const PlatformName: string): string;
    { Does the project support platform specified by PlatformName? }
    function GetSupported(const PlatformName: string): Boolean;
    { Return an array of strings representing the valid platforms for a project }
    function GetSupportedPlatforms: TArray<string>;
    { Set a platform as disabled for this project (cannot be made active) }
    procedure SetEnabled(const PlatformName: string; Value: Boolean);
    { Set the profile name for the specified platform. Pass an empty string to
      clear the profile }
    procedure SetProfile(const PlatformName, ProfileName: string);
    { Indicate the specified platform is supported or not }
    procedure SetSupported(const PlatformName: string; Value: Boolean);
    { Return whether or not the profile associated with PlatformName is the default profile
      for that platform }
    function UsingDefaultProfile(const PlatformName: string): Boolean;

    property EnabledPlatforms: TArray<string> read GetEnabledPlatforms;
    property Enabled[const PlatformName: string]: Boolean read GetEnabled write SetEnabled;
    property Profile[const PlatformName: string]: string read GetProfile write SetProfile;
    property Supported[const PlatformName: string]: Boolean read GetSupported write SetSupported;
    property SupportedPlatforms: TArray<string> read GetSupportedPlatforms;
  end;

Der AddPlatform Methode scheint dein Typ zu sein.

Beachten Sie, dass ich nicht versucht habe, die Methode aufzurufen.Eigentlich habe ich nur nach dem Wort gesucht Plattform im Tools-API-Quellordner.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top