/// <summary> /// Allows user to point to a different app manifest /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelectAppManifest(object sender, EventArgs e) { // Prompt for path OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Application Manifests (*.manifest)|*.manifest|All Files (*.*)|*.*"; // Use last path if available if (!string.IsNullOrEmpty(Settings.Default.LastManifestPath) && (Directory.Exists(Settings.Default.LastManifestPath))) { ofd.InitialDirectory = Settings.Default.LastManifestPath; } // Load file list if user selects manifest if (ofd.ShowDialog() == DialogResult.OK) { string fileName = ofd.FileName; try { m_AppManifest = ManifestHelper.LoadAppManifest(fileName); m_Prerequisites = ManifestHelper.GetPrerequisites(m_AppManifest); m_Files = ManifestHelper.GetFiles(m_AppManifest); filesBindingSource.DataSource = m_Files; ManifestHelper.UpdateDeployManifestAppReference(m_DeployManifest, m_AppManifest); appManifestPathTextBox.Text = m_DeployManifest.EntryPoint.TargetPath; EnableToolStripItems(true); } catch { MessageBox.Show("Invalid manifest"); } } }
/// <summary> /// Handle manifest open command /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnFileOpen(object sender, EventArgs e) { // Prompt for location of deployment manifest OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Deployment Manifests (*.application)|*.application|All Files(*.*)|*.*"; // Restore last manifest location if available if (!string.IsNullOrEmpty(Settings.Default.LastManifestPath) && Directory.Exists(Settings.Default.LastManifestPath)) { ofd.InitialDirectory = Settings.Default.LastManifestPath; } // Path selected if (ofd.ShowDialog() == DialogResult.OK) { string fileName = ofd.FileName; // Save for next time Settings.Default.LastManifestPath = Path.GetDirectoryName(fileName); Settings.Default.Save(); bool appManifestAvail = false; // Load the details try { ManifestHelper.LoadDeploymentManifestData(fileName, out m_DeployManifest, out m_AppManifest); appManifestAvail = true; } catch (FileNotFoundException fex) { MessageBox.Show("Unable to locate referenced application manifest\n" + fex.FileName); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } // Update UI fields appIdTextBox.Text = m_DeployManifest.AssemblyIdentity.Name; versionTextBox.Text = m_DeployManifest.AssemblyIdentity.Version; depProviderTextBox.Text = m_DeployManifest.DeploymentUrl; // Update app manifest details if (appManifestAvail) { m_Prerequisites = ManifestHelper.GetPrerequisites(m_AppManifest); m_Files = ManifestHelper.GetFiles(m_AppManifest); filesBindingSource.DataSource = m_Files; //If the user used mage at all, it will replace the space in "Application Files" with a %20. //Check for it and replace it if found. RobinDotNet 4/7/2010 appManifestPathTextBox.Text = m_DeployManifest.EntryPoint.TargetPath.Replace("%20", " "); EnableToolStripItems(true); } else { EnableToolStripItems(false); } _dirty = false; } }