1namespace Wixl {
2
3    public class MSIDefault {
4        [Flags]
5        public enum ActionFlags {
6            ADMIN_EXECUTE_SEQUENCE,
7            ADMIN_UI_SEQUENCE,
8            ADVT_EXECUTE_SEQUENCE,
9            INSTALL_EXECUTE_SEQUENCE,
10            INSTALL_UI_SEQUENCE,
11
12            ALL = -1,
13        }
14
15        public struct ActionInfo {
16            string name;
17            string? condition;
18            int sequence;
19            ActionFlags flags;
20        }
21
22        public enum Action {
23            InstallInitialize,
24            InstallExecute,
25            InstallExecuteAgain,
26            InstallFinalize,
27            InstallFiles,
28            InstallAdminPackage,
29            FileCost,
30            CostInitialize,
31            CostFinalize,
32            InstallValidate,
33            ExecuteAction,
34            CreateShortcuts,
35            MsiPublishAssemblies,
36            PublishComponents,
37            PublishFeatures,
38            PublishProduct,
39            RegisterClassInfo,
40            RegisterExtensionInfo,
41            RegisterMIMEInfo,
42            RegisterProgIdInfo,
43            AllocateRegistrySpace,
44            AppSearch,
45            BindImage,
46            CCPSearch,
47            CreateFolders,
48            DeleteServices,
49            DuplicateFiles,
50            FindRelatedProducts,
51            InstallODBC,
52            InstallServices,
53            MsiConfigureServices,
54            IsolateComponents,
55            LaunchConditions,
56            MigrateFeatureStates,
57            MoveFiles,
58            PatchFiles,
59            ProcessComponents,
60            RegisterComPlus,
61            RegisterFonts,
62            RegisterProduct,
63            RegisterTypeLibraries,
64            RegisterUser,
65            RemoveDuplicateFiles,
66            RemoveEnvironmentStrings,
67            RemoveFiles,
68            RemoveFolders,
69            RemoveIniValues,
70            RemoveODBC,
71            RemoveRegistryValues,
72            RemoveShortcuts,
73            RMCCPSearch,
74            SelfRegModules,
75            SelfUnregModules,
76            SetODBCFolders,
77            StartServices,
78            StopServices,
79            MsiUnpublishAssemblies,
80            UnpublishComponents,
81            UnpublishFeatures,
82            UnregisterClassInfo,
83            UnregisterComPlus,
84            UnregisterExtensionInfo,
85            UnregisterFonts,
86            UnregisterMIMEInfo,
87            UnregisterProgIdInfo,
88            UnregisterTypeLibraries,
89            ValidateProductID,
90            WriteEnvironmentStrings,
91            WriteIniValues,
92            WriteRegistryValues,
93        }
94
95        const ActionInfo[] actions = {
96            { "InstallInitialize", null, 1500, ActionFlags.ADMIN_EXECUTE_SEQUENCE|ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
97            { "InstallExecute", "NOT Installed", 6500, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
98            { "InstallExecuteAgain", "NOT Installed", 6550, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
99            { "InstallFinalize", null, 6600, ActionFlags.ADMIN_EXECUTE_SEQUENCE|ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
100            { "InstallFiles", null, 4000, ActionFlags.ADMIN_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
101            { "InstallAdminPackage", null, 3900, ActionFlags.ADMIN_EXECUTE_SEQUENCE },
102            { "FileCost", null, 900, ActionFlags.ADMIN_EXECUTE_SEQUENCE|ActionFlags.ADMIN_UI_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
103            { "CostInitialize", null, 800, ActionFlags.ALL },
104            { "CostFinalize", null, 1000, ActionFlags.ALL },
105            { "InstallValidate", null, 1400, ActionFlags.ADMIN_EXECUTE_SEQUENCE|ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
106            { "ExecuteAction", null, 1300, ActionFlags.ADMIN_UI_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
107            { "CreateShortcuts", null, 4500, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
108            { "MsiPublishAssemblies", null, 6250, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
109            { "PublishComponents", null, 6200, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
110            { "PublishFeatures", null, 6300, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
111            { "PublishProduct", null, 6400, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
112            { "RegisterClassInfo", null, 4600, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
113            { "RegisterExtensionInfo", null, 4700, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
114            { "RegisterMIMEInfo", null, 4900, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
115            { "RegisterProgIdInfo", null, 4800, ActionFlags.ADVT_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
116            { "AllocateRegistrySpace", "NOT Installed", 1550, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
117            { "AppSearch", null, 50, ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
118            { "BindImage", null, 4300, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
119            { "CCPSearch", "NOT Installed", 500, ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
120            { "CreateFolders", null, 3700, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
121            { "DeleteServices", "VersionNT", 2000, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
122            { "DuplicateFiles", null, 4210, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
123            { "FindRelatedProducts", null, 25, ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
124            { "InstallODBC", null, 5400, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
125            { "InstallServices", "VersionNT", 5800, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
126            { "MsiConfigureServices", "VersionNT>=600", 5850, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
127            { "IsolateComponents", null, 950, ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
128            { "LaunchConditions", null, 100, ActionFlags.ADMIN_EXECUTE_SEQUENCE|ActionFlags.ADMIN_UI_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
129            { "MigrateFeatureStates", null, 1200, ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
130            { "MoveFiles", null, 3800, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
131            { "PatchFiles", null, 4090, ActionFlags.ADMIN_EXECUTE_SEQUENCE|ActionFlags.INSTALL_EXECUTE_SEQUENCE },
132            { "ProcessComponents", null, 1600, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
133            { "RegisterComPlus", null, 5700, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
134            { "RegisterFonts", null, 5300, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
135            { "RegisterProduct", null, 6100, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
136            { "RegisterTypeLibraries", null, 5500, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
137            { "RegisterUser", null, 6000, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
138            { "RemoveDuplicateFiles", null, 3400, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
139            { "RemoveEnvironmentStrings", null, 3300, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
140            { "RemoveFiles", null, 3500, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
141            { "RemoveFolders", null, 3600, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
142            { "RemoveIniValues", null, 3100, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
143            { "RemoveODBC", null, 2400, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
144            { "RemoveRegistryValues", null, 2600, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
145            { "RemoveShortcuts", null, 3200, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
146            { "RMCCPSearch", "NOT Installed", 600, ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
147            { "SelfRegModules", null, 5600, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
148            { "SelfUnregModules", null, 2200, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
149            { "SetODBCFolders", null, 1100, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
150            { "StartServices", "VersionNT", 5900, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
151            { "StopServices", "VersionNT", 1900, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
152            { "MsiUnpublishAssemblies", null, 1750, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
153            { "UnpublishComponents", null, 1700, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
154            { "UnpublishFeatures", null, 1800, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
155            { "UnregisterClassInfo", null, 2700, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
156            { "UnregisterComPlus", null, 2100, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
157            { "UnregisterExtensionInfo", null, 2800, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
158            { "UnregisterFonts", null, 2500, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
159            { "UnregisterMIMEInfo", null, 3000, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
160            { "UnregisterProgIdInfo", null, 2900, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
161            { "UnregisterTypeLibraries", null, 2300, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
162            { "ValidateProductID", null, 700, ActionFlags.INSTALL_EXECUTE_SEQUENCE|ActionFlags.INSTALL_UI_SEQUENCE },
163            { "WriteEnvironmentStrings", null, 5200, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
164            { "WriteIniValues", null, 5100, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
165            { "WriteRegistryValues", null, 5000, ActionFlags.INSTALL_EXECUTE_SEQUENCE },
166        };
167
168        public static ActionInfo get_action (Action action) {
169            return actions[action];
170        }
171
172        public static ActionInfo? get_action_by_name (string name) {
173            ActionInfo? action = null;
174
175            try {
176                action = actions[enum_from_string<Action> (name.down ())];
177            } catch (GLib.Error error) {
178            }
179
180            return action;
181        }
182    }
183
184} // Wixl
185