Revision 349a2d0f trunk/NetSparkle/NetSparkleDownloadProgress.cs
b/trunk/NetSparkle/NetSparkleDownloadProgress.cs | ||
---|---|---|
79 | 79 |
{ |
80 | 80 |
_sparkle.ReportDiagnosticMessage("No DSA check needed"); |
81 | 81 |
} |
82 |
else |
|
82 |
/*else
|
|
83 | 83 |
{ |
84 | 84 |
Boolean bDSAOk = false; |
85 | 85 |
|
... | ... | |
115 | 115 |
lblSecurityHint.Visible = true; |
116 | 116 |
BackColor = Color.Tomato; |
117 | 117 |
} |
118 |
} |
|
118 |
}*/
|
|
119 | 119 |
|
120 | 120 |
// Check the unattended mode |
121 | 121 |
if (_unattend) |
... | ... | |
134 | 134 |
String workingDir = Environment.CurrentDirectory; |
135 | 135 |
|
136 | 136 |
// generate the batch file path |
137 |
|
|
137 | 138 |
String cmd = Environment.ExpandEnvironmentVariables("%temp%\\" + Guid.NewGuid() + ".cmd"); |
138 | 139 |
String installerCMD; |
139 | 140 |
|
140 | 141 |
// get the file type |
141 |
if (Path.GetExtension(_tempName).ToLower().Equals(".exe")) |
|
142 |
{ |
|
143 |
// build the command line |
|
144 |
installerCMD = _tempName; |
|
145 |
} |
|
146 |
else if (Path.GetExtension(_tempName).ToLower().Equals(".msi")) |
|
147 |
{ |
|
148 |
// buid the command line |
|
149 |
installerCMD = "msiexec /i \"" + _tempName + "\""; |
|
150 |
} |
|
151 |
else |
|
142 |
var extension = Path.GetExtension(_tempName).ToLower(); |
|
143 |
switch (extension) |
|
152 | 144 |
{ |
153 |
MessageBox.Show("Updater not supported, please execute " + _tempName + " manually", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); |
|
154 |
Environment.Exit(-1); |
|
155 |
return; |
|
145 |
case ".exe": |
|
146 |
installerCMD = _tempName; |
|
147 |
break; |
|
148 |
case ".msi": |
|
149 |
installerCMD = String.Format("msiexec /i \"{0}\"",_tempName); |
|
150 |
break; |
|
151 |
default: |
|
152 |
MessageBox.Show("Updater not supported, please execute " + _tempName + " manually", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); |
|
153 |
Environment.Exit(-1); |
|
154 |
return; |
|
156 | 155 |
} |
157 | 156 |
|
158 | 157 |
// generate the batch file |
159 | 158 |
_sparkle.ReportDiagnosticMessage("Generating MSI batch in " + Path.GetFullPath(cmd)); |
160 | 159 |
|
161 |
StreamWriter write = new StreamWriter(cmd); |
|
162 |
write.WriteLine(installerCMD); |
|
163 |
write.WriteLine("cd " + workingDir); |
|
164 |
write.WriteLine(cmdLine); |
|
165 |
write.Close(); |
|
160 |
using (var write = new StreamWriter(cmd)) |
|
161 |
{ |
|
162 |
write.WriteLine(installerCMD); |
|
163 |
write.WriteLine("cd " + workingDir); |
|
164 |
write.WriteLine(cmdLine); |
|
165 |
write.Close(); |
|
166 |
} |
|
166 | 167 |
|
167 | 168 |
// report |
168 | 169 |
_sparkle.ReportDiagnosticMessage("Going to execute batch: " + cmd); |
169 | 170 |
|
170 | 171 |
// start the installer helper |
171 |
Process process = new Process();
|
|
172 |
var process = new Process();
|
|
172 | 173 |
process.StartInfo.FileName = cmd; |
173 |
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
|
174 |
process.Start(); |
|
175 |
|
|
174 |
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
|
175 |
process.Start(); |
|
176 | 176 |
|
177 | 177 |
// quit the app |
178 | 178 |
Environment.Exit(0); |
Also available in: Unified diff