-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathamScript.Package.API.pas
More file actions
130 lines (98 loc) · 4.28 KB
/
amScript.Package.API.pas
File metadata and controls
130 lines (98 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
unit amScript.Package.API;
(*
* Copyright © 2012 Anders Melander
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)
interface
uses
Generics.Collections,
Graphics,
Classes,
amScript.Provider.API;
const
sScriptPackageFilenamePrefix = '!';
// -----------------------------------------------------------------------------
//
// IScriptPackage
//
// -----------------------------------------------------------------------------
// A collection of script files executed as a single whole (i.e. a script Document).
// -----------------------------------------------------------------------------
type
TScriptPackageKind = (pkScript, pkBundle);
TScriptExecutionReason = (irSuccess, irUnknown, irCompile, irLicense, irDisable);
IScriptPackage = interface
function GetPluginID: string;
property PluginID: string read GetPluginID;
function GetPluginName: string;
property PluginName: string read GetPluginName;
function GetPluginURI: string;
property PluginURI: string read GetPluginURI;
function GetDescription: string;
property Description: string read GetDescription;
function GetVersion: string;
property Version: string read GetVersion;
function GetAuthor: string;
property Author: string read GetAuthor;
function GetAuthorURI: string;
property AuthorURI: string read GetAuthorURI;
function GetRequires: string;
property Requires: string read GetRequires;
function GetImage: TPicture;
property Image: TPicture read GetImage;
function GetFilename: string;
property Filename: string read GetFilename;
function GetEnabled: boolean;
procedure SetEnabled(Value: boolean);
property Enabled: boolean read GetEnabled write SetEnabled;
function GetRunOnce: boolean;
procedure SetRunOnce(Value: boolean);
property RunOnce: boolean read GetRunOnce write SetRunOnce;
function GetCanUninstall: boolean;
procedure SetCanUninstall(Value: boolean);
// Specifies if package can be uninstalled.
// Packages loaded from the standard script folders can not be uninstalled.
property CanUninstall: boolean read GetCanUninstall write SetCanUninstall;
function GetNeedInstall: boolean;
procedure SetNeedInstall(Value: boolean);
// Specifies if package needs to be installed (True the first time a package is loaded).
// Presently unused.
property NeedInstall: boolean read GetNeedInstall write SetNeedInstall;
function GetAutoUninstall: boolean;
procedure SetAutoUninstall(Value: boolean);
// Specifies if package will be uninstalled automatically once script terminates.
// Used for packages that are being executed but has not been installed. E.g. a package executed via drag drop.
property AutoUninstall: boolean read GetAutoUninstall write SetAutoUninstall;
function GetPackageKind: TScriptPackageKind;
property PackageKind: TScriptPackageKind read GetPackageKind;
function GetLastExecutionResult: TScriptExecutionReason;
procedure SetLastExecutionResult(const Value: TScriptExecutionReason);
property LastExecutionResult: TScriptExecutionReason read GetLastExecutionResult write SetLastExecutionResult;
// License stuff
function GetAuthorID: string;
property AuthorID: string read GetAuthorID;
function GetProductID: string;
property ProductID: string read GetProductID;
function CreateScriptProvider: IScriptProvider;
end;
IScriptPackageInternal = interface(IScriptPackage)
['{BAEF5960-E6C2-4B19-80E8-541D5C97BC3C}']
function LoadFromFile: boolean;
function LoadFromStream(AStream: TStream): boolean;
end;
IScriptPackageList = interface
function GetItem(Index: integer): IScriptPackage;
property Items[Index: integer]: IScriptPackage read GetItem; default;
function GetCount: integer;
property Count: integer read GetCount;
function GetEnumerator: TEnumerator<IScriptPackage>;
function Add(const Filename: string): IScriptPackage;
procedure Remove(const Package: IScriptPackage);
function FindByID(const PluginID: string): IScriptPackage;
function FindByFilename(const Filename: string): IScriptPackage;
end;
implementation
end.