private void addWixModuleMenu_Click(object sender, EventArgs e) { // Open file-dialog OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = true; dlg.InitialDirectory = LastSelectedFolder; dlg.RestoreDirectory = true; dlg.Filter = "Wix source-files (*.wxs)|*.wxs|Wix object-files (*.wixobj)|*.wixobj|All files (*.*)|*.*"; if (dlg.ShowDialog() == DialogResult.OK) { foreach (string file in dlg.FileNames) { try { string my_file = currentProject.projectProperties.UseRelativePaths ? Shell.GetRelativePath(file) : file; string extension = Path.GetExtension(my_file).ToLower(); if ((extension != ".wxs") && (extension != ".wixobj")) { throw new ApplicationException( "The Wix-module \"" + my_file + "\" must have extension \".wxs\" or \".wixobj.\""); } WixModule wix = new WixModule(); wix.Path = my_file; wix.GetInfo(); currentProject.projectWixModules.Add(wix); } catch (Exception ex) { MessageBox.Show("Failed to add the wix-module: \"" + file + "\".\r\n" + ex.Message); break; } } ReloadWixModuleList(); } }
private void wixModulesList_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string file in files) { try { string my_file = currentProject.projectProperties.UseRelativePaths ? Shell.GetRelativePath(file) : file; string extension = Path.GetExtension(my_file).ToLower(); if ((extension != ".wxs") && (extension != ".wixobj")) { throw new ApplicationException( "The Wix-module \"" + my_file + "\" must have extension \".wix\" or \".wixobj.\""); } WixModule wix = new WixModule(); wix.Path = my_file; wix.GetInfo(); currentProject.projectWixModules.Add(wix); } catch (Exception ex) { MessageBox.Show("Failed to add the wix-module: \"" + file + "\".\r\n" + ex.Message); break; } } ReloadWixModuleList(); }