/// <summary> /// Extracts the installers. /// </summary> private void ExtractInstallers( ) { this.LogDebug("Extracting installer"); using (Stream strm = this.GetType( ).Assembly.GetManifestResourceStream("DroidExplorer.Bootstrapper.Installs.Setup.msi")) { if (strm != null) { extractProgress.SetMaximum((int)strm.Length); extractProgress.SetMinimum(0); extractProgress.SetValue(0); byte[] buffer = new byte[2048]; int bread = 0; using (FileStream fs = new FileStream(Path.Combine(InstallersPath, "Setup.msi"), FileMode.Create, FileAccess.Write)) { while ((bread = strm.Read(buffer, 0, buffer.Length)) > 0) { fs.Write(buffer, 0, bread); extractProgress.IncrementExt(bread); } fs.Close( ); } strm.Close( ); } } LaunchInstaller( ); Wizard.Next( ); }
/// <summary> /// Extracts the installers. /// </summary> private void ExtractInstallers( ) { this.LogDebug("Extracting installer"); using (Stream strm = this.GetType( ).Assembly.GetManifestResourceStream("DroidExplorer.Bootstrapper.Installs.Setup.msi")) { if (strm != null) { extractProgress.SetMaximum((int)strm.Length); extractProgress.SetMinimum(0); extractProgress.SetValue(0); byte[] buffer = new byte[2048]; int bread = 0; using (FileStream fs = new FileStream(Path.Combine(InstallersPath, "Setup.msi"), FileMode.Create, FileAccess.Write)) { while ((bread = strm.Read(buffer, 0, buffer.Length)) > 0) { fs.Write(buffer, 0, bread); extractProgress.IncrementExt(bread); } fs.Close( ); } strm.Close( ); } } int result = LaunchInstaller( ); switch (result) { case 0: Wizard.Next( ); break; case 1602: this.LogWarning("Installer was canceled by the user"); Wizard.PromptExit = false; Wizard.PromptCancel = false; Wizard.Cancel( ); break; default: Exception ex = new Exception(string.Format(CultureInfo.InvariantCulture, "Installer exited with code {0}.", result)); this.LogFatal(ex.Message); Wizard.Error(ex); break; } }