forked from svn2github/dotnetzip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostProcessMsi.js
More file actions
176 lines (155 loc) · 6.47 KB
/
Copy pathPostProcessMsi.js
File metadata and controls
176 lines (155 loc) · 6.47 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// PostProcessMSi.js
//
// Post-process the generated MSI :
//
// - move things around on the installdir dialog, and on the progress
// dialog, to make the UI look better.
//
//
// Copyright (c) 2011 Dino Chiesa.
// All rights reserved.
//
// This code module is part of DotNetZip, a zipfile class library.
//
// ------------------------------------------------------------------
//
// This code, like all of DotNetZip, is licensed under the Microsoft
// Public License. See the file License.txt accompanying this source
// modeule for the license details. More info on:
// http://dotnetzip.codeplex.com
//
// Created: Thu, 14 Jul 2011 17:31
// Last saved: <2011-July-28 12:36:05>
//
// Constant values from Windows Installer
var msiOpenDatabaseMode = {
Transact : 1
};
var msiViewModify = {
Insert : 1,
Update : 2,
Assign : 3,
Replace : 4,
Delete : 6
};
if (WScript.Arguments.Length != 1){
WScript.StdErr.WriteLine(WScript.ScriptName + " file");
WScript.Quit(1);
}
var filespec = WScript.Arguments(0);
WScript.Echo(WScript.ScriptName + " " + filespec);
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec, msiOpenDatabaseMode.Transact);
var sql;
var view;
var record;
try {
// var fileId = FindFileIdentifier(database, filename);
// if (!fileId){
// throw new Error ("Unable to find '" + filename + "' in File table");
// }
WScript.Echo("Updating the Control table...");
// // Move the checkbox on the exit dialog, so that it appears in the row of buttons.
// // We do this because the background on the checkbox is gray, unchangeably so.
// // but the bg for the row of buttons is gray, so it looks ok if moved there.
// sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height` FROM `Control` WHERE `Dialog_`='ExitDialog' AND `Control`='OptionalCheckBox'";
// view = database.OpenView(sql);
// view.Execute();
// record = view.Fetch();
// // index starts at 1
// record.IntegerData(4) = 14; // X
// record.IntegerData(5) = 243; // Y
// record.IntegerData(6) = 120; // Width
// record.IntegerData(7) = 16; // Height
// view.Modify(msiViewModify.Replace, record);
// view.Close();
// Insert a new checkbox into the InstallDirDlg.
// This one controls whether to associate zip files to DotNetZip.
// sql = "SELECT `Control` FROM `Control` WHERE `Control`='CheckboxAssoc'";
// view = database.OpenView(sql);
// view.Execute();
// record = view.Fetch();
// var controlExists = null;
// if (record != null) controlExists = record.StringData(1);
// if (record == null || controlExists != "CheckboxAssoc") {
//
// sql = "INSERT INTO `Control` (`Dialog_`, `Control`, `Type`, `X`, `Y`, " +
// "`Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help`) " +
// "VALUES ('InstallDirDlg', 'CheckboxAssoc', 'CheckBox', '20', '124', '184', '14', '3', "+
// "'WANT_ZIP_ASSOCIATIONS', 'Associate .zip files to DotNetZip', 'Next', '|')";
// view = database.OpenView(sql);
// view.Execute();
// view.Close();
//
// sql = "UPDATE `Control` SET `Control`.`Control_Next` = 'CheckboxAssoc' " +
// "WHERE `Control`.`Dialog_`='InstallDirDlg' AND `Control`.`Control`='ChangeFolder'";
// view = database.OpenView(sql);
// view.Execute();
// view.Close();
// }
// Tweak the existing controls on the InstallDirDlg: move them up a bit, shrink the label
sql = "UPDATE `Control` SET `Control`.`Y` = 76 " +
"WHERE `Control`.`Dialog_`='InstallDirDlg' AND `Control`.`Control`='Folder'";
view = database.OpenView(sql);
view.Execute();
view.Close();
sql = "UPDATE `Control` SET `Control`.`Y` = 96 " +
"WHERE `Control`.`Dialog_`='InstallDirDlg' AND `Control`.`Control`='ChangeFolder'";
view = database.OpenView(sql);
view.Execute();
view.Close();
sql = "UPDATE `Control` SET `Control`.`Height` = 16 " +
"WHERE `Control`.`Dialog_`='InstallDirDlg' AND `Control`.`Control`='FolderLabel'";
view = database.OpenView(sql);
view.Execute();
view.Close();
// Tweak the existing controls on the ProgressDlg: move the status
// text up a bit, and make it taller, because it was being clipped
// by its own height, and also by the proximity of the progress bar.
// These seem like basic fit-and-finish problems that Wix shouldn't have.
// WIX is an idiot.
sql = "UPDATE `Control` SET `Control`.`Y` = 96, `Control`.`Height` = 14 " +
"WHERE `Control`.`Dialog_`='ProgressDlg' AND `Control`.`Control`='StatusLabel'";
view = database.OpenView(sql);
view.Execute();
view.Close();
sql = "UPDATE `Control` SET `Control`.`Y` = 96, `Control`.`Height` = 14 " +
"WHERE `Control`.`Dialog_`='ProgressDlg' AND `Control`.`Control`='ActionText'";
view = database.OpenView(sql);
view.Execute();
view.Close();
sql = "UPDATE `Control` SET `Control`.`Y` = 58 " +
"WHERE `Control`.`Dialog_`='ProgressDlg' AND `Control`.`Control`='TextInstalling'";
view = database.OpenView(sql);
view.Execute();
view.Close();
sql = "UPDATE `Control` SET `Control`.`Y` = 58 " +
"WHERE `Control`.`Dialog_`='ProgressDlg' AND `Control`.`Control`='TextChanging'";
view = database.OpenView(sql);
view.Execute();
view.Close();
sql = "UPDATE `Control` SET `Control`.`Y` = 58 " +
"WHERE `Control`.`Dialog_`='ProgressDlg' AND `Control`.`Control`='TextRepairing'";
view = database.OpenView(sql);
view.Execute();
view.Close();
sql = "UPDATE `Control` SET `Control`.`Y` = 58 " +
"WHERE `Control`.`Dialog_`='ProgressDlg' AND `Control`.`Control`='TextRemoving'";
view = database.OpenView(sql);
view.Execute();
view.Close();
// if (checkboxChecked) {
// WScript.Echo("Updating the Property table...");
// // Set the default value of the CheckBox
// sql = "INSERT INTO `Property` (`Property`, `Value`) VALUES ('LAUNCHAPP', '1')";
// view = database.OpenView(sql);
// view.Execute();
// view.Close();
// }
// WScript.Echo("G");
database.Commit();
}
catch(e) {
WScript.StdErr.WriteLine(e);
WScript.Quit(1);
}