throw new ApplicationException(string.Format("Could not found {0}install script", Silent? "silent " : ""));\r
}\r
\r
- if (UninstalledPackage.UninstallInfo.WindowsInstaller &&\r
+ if (UninstalledPackage.Type == InstallerType.ARCHIVE\r
+ || UninstalledPackage.Type == InstallerType.ITSELF) {\r
+ \r
+ string argument = string.Format("-x \"{0}\"", UninstalledPackage.Name);\r
+ using (Process hProcess = createExtractArchiveProcess(argument,\r
+ this.OutputDataReceived,\r
+ this.ErrorDataReceived)) {\r
+ \r
+ if (NaGet.Env.InstallProcessOnBackground) {\r
+ try {\r
+ hProcess.PriorityClass = ProcessPriorityClass.Idle;\r
+ } catch (Exception) {}\r
+ }\r
+ \r
+ hProcess.WaitForExit();\r
+ \r
+ exitValue = hProcess.ExitCode;\r
+ }\r
+ } else if (UninstalledPackage.UninstallInfo.WindowsInstaller &&\r
Regex.Match(uninstallString.Substring("MsiExec.exe /I".Length),\r
@"^\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}$").Success) {\r
string guid = uninstallString.Substring("MsiExec.exe /I".Length);\r
using (Process hProcess = NaGet.Utils.ProcessStartWithOutputCapture(\r
new ProcessStartInfo("msiexec", string.Format("/X{0}", guid)),\r
- NaGet.Utils.ConvertToDataReceivedEventHandler(OutputDataReceived),\r
- NaGet.Utils.ConvertToDataReceivedEventHandler(ErrorDataReceived)) ) {\r
+ this.OutputDataReceived,\r
+ this.ErrorDataReceived) ) {\r
\r
if (NaGet.Env.InstallProcessOnBackground) {\r
try {\r
// 単独のファイルの場合\r
using (Process hProcess = NaGet.Utils.ProcessStartWithOutputCapture(\r
new ProcessStartInfo(uninstallString),\r
- NaGet.Utils.ConvertToDataReceivedEventHandler(OutputDataReceived),\r
- NaGet.Utils.ConvertToDataReceivedEventHandler(ErrorDataReceived)) ) {\r
+ this.OutputDataReceived,\r
+ this.ErrorDataReceived) ) {\r
\r
if (NaGet.Env.InstallProcessOnBackground) {\r
try {\r
return exitValue;\r
}\r
\r
+ /// <summary>\r
+ /// アーカイブファイルのアンインストールを行う\r
+ /// </summary>\r
+ /// <param name="archiveInstArgs">"archive-inst.exe"への引数</param>\r
+ /// <param name="outputReceived">標準出力用リスナ(null可)</param>\r
+ /// <param name="errorReceived">エラー出力用リスナ(null可)</param>\r
+ /// <returns>実行プロセス</returns>\r
+ private static Process createExtractArchiveProcess(string archiveInstArgs,\r
+ EventHandler<NaGet.Utils.AnyDataEventArgs<string>> outputReceived,\r
+ EventHandler<NaGet.Utils.AnyDataEventArgs<string>> errorReceived)\r
+ {\r
+ string archiveInstExe = Path.GetFullPath("archive-inst.exe");\r
+ if (! File.Exists(archiveInstExe)) {\r
+ string errMsg = string.Format("\"{0}\" does not found!");\r
+ throw new ApplicationException(errMsg,\r
+ new FileNotFoundException(errMsg, archiveInstExe));\r
+ }\r
+ \r
+ \r
+ \r
+ ProcessStartInfo procInfo = new ProcessStartInfo(archiveInstExe, archiveInstArgs);\r
+ procInfo.UseShellExecute = false;\r
+ procInfo.CreateNoWindow = true;\r
+ procInfo.WorkingDirectory = Environment.CurrentDirectory;\r
+ \r
+ return NaGet.Utils.ProcessStartWithOutputCapture(procInfo, outputReceived, errorReceived);\r
+ }\r
+ \r
public override string ToString()\r
{\r
return string.Format("{0}({1})", UninstalledPackage.Name, UninstalledPackage.Version);\r