private void SetDefaultPackage() { EmbeddedPackage[] embedded = PackageUtility.GetEmbeddedPackages(); // skip this page and load the first embedded package if (embedded.Length > 0) { EmbeddedPackage package = embedded[0] as EmbeddedPackage; System.IO.Stream stream = PackageUtility.GetEmbeddedPackage(package); PackageInfo.Source = PackageSource.Embedded; PackageInfo.SourcePath = package.Name; PackageInfo.Archive = PackageArchive.FromStream(package.Name, PackageSubclass.LzmaTarball, stream); } }
private void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { String path = e.UserState as String; // reload the package and go back to Extracting Stream fs = File.OpenRead(path); PackageInfo.Source = PackageSource.Archive; PackageInfo.SourcePath = path; PackageInfo.Archive = PackageArchive.FromStream(Path.GetFileNameWithoutExtension(path), PackageSubclass.LzmaTarball, fs); _nextPage = Program.PageCBExtracting; WizardForm.EnableBack = false; WizardForm.EnableNext = true; }
private void SelectPackagePage_PageUnload(object sender, W3b.Wizards.PageChangeEventArgs e) { if (InstallerResources.IsCustomized && InstallerResources.CustomizedSettings.SimpleUI) { return; } if (e.PageToBeLoaded == Program.PageBMainAction) { return; } if (__embedRad.Checked) { if (__embedList.SelectedItem == null) { MessageBox.Show(this, InstallerResources.GetString("C_A_selectEmbeddedPackageFirst"), "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); e.Cancel = true; return; } EmbeddedPackage package = __embedList.SelectedItem as EmbeddedPackage; Stream stream = PackageUtility.GetEmbeddedPackage(package); PackageInfo.Source = PackageSource.Embedded; PackageInfo.SourcePath = package.Name; PackageInfo.Archive = PackageArchive.FromStream(package.Name, PackageSubclass.LzmaTarball, stream); } else if (__packRad.Checked) { if (!File.Exists(__packFilename.Text)) { String message = String.Format(CultureInfo.InvariantCulture, InstallerResources.GetString("C_A_notFileExists"), __anopFilename.Text); MessageBox.Show(this, message, "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); e.Cancel = true; return; } String packageName = new DirectoryInfo(Path.GetDirectoryName(__packFilename.Text)).Name; PackageInfo.Source = PackageSource.File; PackageInfo.SourcePath = __packFilename.Text; } else if (__anopRad.Checked) { if (!File.Exists(__anopFilename.Text)) { String message = String.Format(CultureInfo.InvariantCulture, InstallerResources.GetString("C_A_notFileExists"), __anopFilename.Text); MessageBox.Show(this, message, "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); e.Cancel = true; return; } String packageName = Path.GetFileNameWithoutExtension(__anopFilename.Text); Stream stream = File.OpenRead(__anopFilename.Text); PackageInfo.Source = PackageSource.Archive; PackageInfo.SourcePath = __anopFilename.Text; PackageInfo.Archive = PackageArchive.FromStream(packageName, PackageSubclass.LzmaTarball, stream); } }