Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1749 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
22 changed files with 1160 additions and 5 deletions
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="LinkerParametersPanel" /> |
||||
<ClientSize value="{Width=602, Height=319}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="compilerExtensionsGroupBox" /> |
||||
<Location value="3, 15" /> |
||||
<Text value="Extensions" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="596, 175" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
||||
@ -1,5 +1,16 @@
@@ -1,5 +1,16 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="LinkerParametersPanel" /> |
||||
<ClientSize value="{Width=602, Height=319}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="compilerExtensionsGroupBox" /> |
||||
<Location value="3, 15" /> |
||||
<Text value="Extensions" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="596, 175" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
||||
|
||||
@ -0,0 +1,203 @@
@@ -0,0 +1,203 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
/// <summary>
|
||||
/// Dialog that allows the user to add standard compiler extensions. Only
|
||||
/// the standard compiler extensions are displayed.
|
||||
/// </summary>
|
||||
public class AddCompilerExtensionsDialog : System.Windows.Forms.Form |
||||
{ |
||||
List<WixCompilerExtensionName> currentExtensions = new List<WixCompilerExtensionName>(); |
||||
bool changed; |
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of this dialog.
|
||||
/// </summary>
|
||||
/// <param name="currentExtensions">The current extensions selected
|
||||
/// by the user. This is used to tick the standard WiX extensions that
|
||||
/// have already been added to the project.</param>
|
||||
/// <param name="standardExtensions">The standard WiX extensions (e.g. NetFx)
|
||||
/// that are available for the user.</param>
|
||||
public AddCompilerExtensionsDialog(WixCompilerExtensionName[] currentExtensions, WixCompilerExtensionName[] standardExtensions) |
||||
{ |
||||
InitializeComponent(); |
||||
this.currentExtensions.AddRange(currentExtensions); |
||||
AddStandardExtensions(standardExtensions); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether one or more extensions have been added or removed
|
||||
/// by the user.
|
||||
/// </summary>
|
||||
public bool IsChanged { |
||||
get { |
||||
return changed; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the new set of extensions selected. This includes the current
|
||||
/// extensions that are not considered standard extensions and were
|
||||
/// passed to the constructor of this class.
|
||||
/// </summary>
|
||||
public WixCompilerExtensionName[] GetExtensions() |
||||
{ |
||||
UpdateCurrentExtensions(); |
||||
|
||||
List<WixCompilerExtensionName> extensions = new List<WixCompilerExtensionName>(); |
||||
foreach (WixCompilerExtensionName extensionName in currentExtensions) { |
||||
extensions.Add(extensionName); |
||||
} |
||||
return extensions.ToArray(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the form.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
#region Windows Forms Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
void InitializeComponent() |
||||
{ |
||||
this.extensionsListView = new System.Windows.Forms.ListView(); |
||||
this.okButton = new System.Windows.Forms.Button(); |
||||
this.cancelButton = new System.Windows.Forms.Button(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// extensionsListView
|
||||
//
|
||||
this.extensionsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
| System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right))); |
||||
this.extensionsListView.CheckBoxes = true; |
||||
this.extensionsListView.Location = new System.Drawing.Point(0, 0); |
||||
this.extensionsListView.Name = "extensionsListView"; |
||||
this.extensionsListView.Size = new System.Drawing.Size(466, 255); |
||||
this.extensionsListView.Sorting = System.Windows.Forms.SortOrder.Ascending; |
||||
this.extensionsListView.TabIndex = 0; |
||||
this.extensionsListView.UseCompatibleStateImageBehavior = false; |
||||
this.extensionsListView.View = System.Windows.Forms.View.List; |
||||
this.extensionsListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.ExtensionsListViewItemChecked); |
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; |
||||
this.okButton.Location = new System.Drawing.Point(294, 261); |
||||
this.okButton.Name = "okButton"; |
||||
this.okButton.Size = new System.Drawing.Size(75, 23); |
||||
this.okButton.TabIndex = 1; |
||||
this.okButton.Text = "OK"; |
||||
this.okButton.UseVisualStyleBackColor = true; |
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
||||
this.cancelButton.Location = new System.Drawing.Point(379, 261); |
||||
this.cancelButton.Name = "cancelButton"; |
||||
this.cancelButton.Size = new System.Drawing.Size(75, 23); |
||||
this.cancelButton.TabIndex = 2; |
||||
this.cancelButton.Text = "Cancel"; |
||||
this.cancelButton.UseVisualStyleBackColor = true; |
||||
//
|
||||
// AddCompilerExtensionsDialog
|
||||
//
|
||||
this.AcceptButton = this.okButton; |
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.CancelButton = this.cancelButton; |
||||
this.ClientSize = new System.Drawing.Size(466, 291); |
||||
this.Controls.Add(this.cancelButton); |
||||
this.Controls.Add(this.okButton); |
||||
this.Controls.Add(this.extensionsListView); |
||||
this.MaximizeBox = false; |
||||
this.MinimizeBox = false; |
||||
this.MinimumSize = new System.Drawing.Size(200, 100); |
||||
this.Name = "AddCompilerExtensionsDialog"; |
||||
this.ShowIcon = false; |
||||
this.ShowInTaskbar = false; |
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; |
||||
this.Text = "Add Extensions"; |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.Button cancelButton; |
||||
private System.Windows.Forms.Button okButton; |
||||
private System.Windows.Forms.ListView extensionsListView; |
||||
|
||||
#endregion
|
||||
|
||||
void AddStandardExtensions(WixCompilerExtensionName[] extensions) |
||||
{ |
||||
foreach (WixCompilerExtensionName extension in extensions) { |
||||
ListViewItem item = extensionsListView.Items.Add(extension.DisplayName); |
||||
item.Tag = extension; |
||||
item.Checked = currentExtensions.Contains(extension); |
||||
} |
||||
} |
||||
|
||||
void ExtensionsListViewItemChecked(object sender, ItemCheckedEventArgs e) |
||||
{ |
||||
changed = true; |
||||
} |
||||
|
||||
void CreateCurrentExtensions(string[] extensions) |
||||
{ |
||||
foreach (string extension in extensions) { |
||||
currentExtensions.Add(new WixCompilerExtensionName(extension)); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Adds and removes any extensions that have been checked or
|
||||
/// unchecked.
|
||||
/// </summary>
|
||||
void UpdateCurrentExtensions() |
||||
{ |
||||
foreach (ListViewItem item in extensionsListView.Items) { |
||||
WixCompilerExtensionName extension = (WixCompilerExtensionName)item.Tag; |
||||
if (item.Checked) { |
||||
if (!currentExtensions.Contains(extension)) { |
||||
currentExtensions.Add(extension); |
||||
} |
||||
} else { |
||||
int index = currentExtensions.IndexOf(extension); |
||||
if (index >= 0) { |
||||
currentExtensions.RemoveAt(index); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Internal.ExternalTool; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
public class LibraryParametersPanel : AbstractProjectOptionPanel |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.WixBinding.Resources.LibraryParametersPanel.xfrm")); |
||||
InitializeHelper(); |
||||
|
||||
// Add the extension picker in manually since the anchoring does not
|
||||
// work if we add the picker into the XML of the LibraryParametersPanel.xfrm file.
|
||||
WixCompilerExtensionPicker extensionPicker = new WixCompilerExtensionPicker(); |
||||
extensionPicker.Dock = DockStyle.Fill; |
||||
ControlDictionary["compilerExtensionsGroupBox"].Controls.Add(extensionPicker); |
||||
extensionPicker.ExtensionsChanged += CompilerExtensionsChanged; |
||||
|
||||
WixCompilerExtensionBinding b = new WixCompilerExtensionBinding(extensionPicker); |
||||
helper.AddBinding("LibExtension", b); |
||||
|
||||
helper.AddConfigurationSelector(this); |
||||
} |
||||
|
||||
void CompilerExtensionsChanged(object source, EventArgs e) |
||||
{ |
||||
IsDirty = true; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,109 @@
@@ -0,0 +1,109 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
public class WixCompilerExtensionBinding : ConfigurationGuiBinding |
||||
{ |
||||
WixCompilerExtensionPicker extensionPicker; |
||||
|
||||
enum WixExtensionType { |
||||
Compiler, |
||||
Linker, |
||||
Library |
||||
} |
||||
|
||||
public WixCompilerExtensionBinding(WixCompilerExtensionPicker extensionPicker) |
||||
{ |
||||
this.extensionPicker = extensionPicker; |
||||
} |
||||
|
||||
public override bool Save() |
||||
{ |
||||
RemoveExistingProjectExtensions(); |
||||
|
||||
IProject project = Project; |
||||
WixCompilerExtensionName[] extensions = extensionPicker.GetExtensions(); |
||||
foreach (WixCompilerExtensionName extension in extensions) { |
||||
project.Items.Add(CreateProjectItem(extension)); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public override void Load() |
||||
{ |
||||
ReadOnlyCollection<WixExtensionProjectItem> extensions = GetExtensions(); |
||||
foreach (WixExtensionProjectItem extension in extensions) { |
||||
extensionPicker.AddExtension(extension.QualifiedName); |
||||
} |
||||
} |
||||
|
||||
WixExtensionProjectItem CreateProjectItem(WixCompilerExtensionName extension) |
||||
{ |
||||
WixExtensionProjectItem projectItem; |
||||
switch (ExtensionType) { |
||||
case WixExtensionType.Compiler: |
||||
projectItem = new WixCompilerExtensionProjectItem(Project); |
||||
break; |
||||
case WixExtensionType.Library: |
||||
projectItem = new WixLibraryExtensionProjectItem(Project); |
||||
break; |
||||
default: |
||||
projectItem = new WixLinkerExtensionProjectItem(Project); |
||||
break; |
||||
} |
||||
projectItem.Include = extension.AssemblyName; |
||||
projectItem.ClassName = extension.ClassName; |
||||
return projectItem; |
||||
} |
||||
|
||||
ReadOnlyCollection<WixExtensionProjectItem> GetExtensions() |
||||
{ |
||||
switch (ExtensionType) { |
||||
case WixExtensionType.Compiler: |
||||
return WixProject.WixCompilerExtensions; |
||||
case WixExtensionType.Library: |
||||
return WixProject.WixLibraryExtensions; |
||||
default: |
||||
return WixProject.WixLinkerExtensions; |
||||
} |
||||
} |
||||
|
||||
WixProject WixProject { |
||||
get { |
||||
return (WixProject)Project; |
||||
} |
||||
} |
||||
|
||||
WixExtensionType ExtensionType { |
||||
get { |
||||
switch (Property) { |
||||
case "CompileExtension": |
||||
return WixExtensionType.Compiler; |
||||
case "LibExtension": |
||||
return WixExtensionType.Library; |
||||
case "LinkExtension": |
||||
return WixExtensionType.Linker; |
||||
default: |
||||
throw new ApplicationException("Unknown WiX extension type: " + Property); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void RemoveExistingProjectExtensions() |
||||
{ |
||||
IProject project = Project; |
||||
foreach (ProjectItem item in GetExtensions()) { |
||||
project.Items.Remove(item); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,179 @@
@@ -0,0 +1,179 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.Core; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
/// <summary>
|
||||
/// Allows the user to add/remove Wix compiler, linker or library extensions.
|
||||
/// </summary>
|
||||
public class WixCompilerExtensionPicker : System.Windows.Forms.UserControl |
||||
{ |
||||
public event EventHandler ExtensionsChanged; |
||||
|
||||
public WixCompilerExtensionPicker() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Adds an extension to the list.
|
||||
/// </summary>
|
||||
public void AddExtension(string extension) |
||||
{ |
||||
extensionsTextBox.AppendText(String.Concat(extension, "\r\n")); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Clears the extensions list.
|
||||
/// </summary>
|
||||
public void Clear() |
||||
{ |
||||
extensionsTextBox.Text = String.Empty; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Adds a set of extensions to the picker.
|
||||
/// </summary>
|
||||
public void AddExtensions(WixCompilerExtensionName[] extensions) |
||||
{ |
||||
foreach (WixCompilerExtensionName extension in extensions) { |
||||
AddExtension(extension.QualifiedName); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the extensions in the list.
|
||||
/// </summary>
|
||||
public WixCompilerExtensionName[] GetExtensions() |
||||
{ |
||||
List<WixCompilerExtensionName> extensions = new List<WixCompilerExtensionName>(); |
||||
foreach (string line in extensionsTextBox.Lines) { |
||||
if (line.Length > 0) { |
||||
extensions.Add(new WixCompilerExtensionName(line)); |
||||
} |
||||
} |
||||
return extensions.ToArray(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the control.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
#region Windows Forms Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
void InitializeComponent() |
||||
{ |
||||
this.extensionsTextBox = new System.Windows.Forms.RichTextBox(); |
||||
this.addButton = new System.Windows.Forms.Button(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// extensionsTextBox
|
||||
//
|
||||
this.extensionsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
| System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right))); |
||||
this.extensionsTextBox.Location = new System.Drawing.Point(0, 0); |
||||
this.extensionsTextBox.Name = "extensionsTextBox"; |
||||
this.extensionsTextBox.Size = new System.Drawing.Size(370, 109); |
||||
this.extensionsTextBox.TabIndex = 0; |
||||
this.extensionsTextBox.Text = ""; |
||||
this.extensionsTextBox.TextChanged += new System.EventHandler(this.ExtensionsTextBoxTextChanged); |
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
||||
this.addButton.Location = new System.Drawing.Point(301, 115); |
||||
this.addButton.Name = "addButton"; |
||||
this.addButton.Size = new System.Drawing.Size(66, 24); |
||||
this.addButton.TabIndex = 1; |
||||
this.addButton.Text = "Add..."; |
||||
this.addButton.UseVisualStyleBackColor = true; |
||||
this.addButton.Click += new System.EventHandler(this.AddButtonClick); |
||||
//
|
||||
// WixCompilerExtensionPicker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.Controls.Add(this.addButton); |
||||
this.Controls.Add(this.extensionsTextBox); |
||||
this.MinimumSize = new System.Drawing.Size(370, 134); |
||||
this.Name = "WixCompilerExtensionPicker"; |
||||
this.Size = new System.Drawing.Size(370, 142); |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.Button addButton; |
||||
private System.Windows.Forms.RichTextBox extensionsTextBox; |
||||
|
||||
#endregion
|
||||
|
||||
void OnExtensionsChanged() |
||||
{ |
||||
if (ExtensionsChanged != null) { |
||||
ExtensionsChanged(this, new EventArgs()); |
||||
} |
||||
} |
||||
|
||||
void AddButtonClick(object sender, EventArgs e) |
||||
{ |
||||
using (AddCompilerExtensionsDialog dialog = new AddCompilerExtensionsDialog(GetExtensions(), GetStandardExtensions())) { |
||||
if (DialogResult.OK == dialog.ShowDialog() && dialog.IsChanged) { |
||||
Clear(); |
||||
AddExtensions(dialog.GetExtensions()); |
||||
OnExtensionsChanged(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns a list of the standard Wix Compiler extensions.
|
||||
/// These are defined in the WixBinding.addin file.
|
||||
/// </summary>
|
||||
WixCompilerExtensionName[] GetStandardExtensions() |
||||
{ |
||||
List<WixCompilerExtensionName> extensionNames = new List<WixCompilerExtensionName>(); |
||||
List<string> extensions = AddInTree.BuildItems<string>("/AddIns/WixBinding/CompilerExtensions", this); |
||||
|
||||
foreach (string extension in extensions) { |
||||
extensionNames.Add(WixCompilerExtensionName.CreateFromString(extension)); |
||||
} |
||||
|
||||
return extensionNames.ToArray(); |
||||
} |
||||
|
||||
void ExtensionsTextBoxTextChanged(object sender, EventArgs e) |
||||
{ |
||||
OnExtensionsChanged(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,97 @@
@@ -0,0 +1,97 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
public class WixCompilerExtensionName |
||||
{ |
||||
string assemblyName; |
||||
string className; |
||||
string displayName = String.Empty; |
||||
|
||||
public WixCompilerExtensionName(string qualifiedName) |
||||
{ |
||||
int index = qualifiedName.IndexOf(','); |
||||
if (index >= 0) { |
||||
className = qualifiedName.Substring(0, index).Trim(); |
||||
assemblyName = qualifiedName.Substring(index + 1).Trim(); |
||||
} else { |
||||
className = qualifiedName; |
||||
assemblyName = String.Empty; |
||||
} |
||||
} |
||||
|
||||
public WixCompilerExtensionName(string assemblyName, string className) |
||||
{ |
||||
this.assemblyName = assemblyName; |
||||
this.className = className; |
||||
} |
||||
|
||||
public string AssemblyName { |
||||
get { |
||||
return assemblyName; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the qualified name for the extension "ClassName, AssemblyName".
|
||||
/// </summary>
|
||||
public string QualifiedName { |
||||
get { |
||||
if (assemblyName.Length > 0) { |
||||
return String.Concat(className, ", ", assemblyName); |
||||
} |
||||
return className; |
||||
} |
||||
} |
||||
|
||||
public string ClassName { |
||||
get { |
||||
return className; |
||||
} |
||||
} |
||||
|
||||
public string DisplayName { |
||||
get { |
||||
return displayName; |
||||
} |
||||
set { |
||||
displayName = value; |
||||
} |
||||
} |
||||
|
||||
public override bool Equals(object obj) |
||||
{ |
||||
WixCompilerExtensionName name = (WixCompilerExtensionName)obj; |
||||
return name.assemblyName == assemblyName && name.className == className; |
||||
} |
||||
|
||||
public override int GetHashCode() |
||||
{ |
||||
return assemblyName.GetHashCode() ^ className.GetHashCode(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates a new WixCompilerExtensionName from a string of the form
|
||||
/// "AssemblyName, ClassName|DisplayName".
|
||||
/// </summary>
|
||||
public static WixCompilerExtensionName CreateFromString(string s) |
||||
{ |
||||
int index = s.IndexOf("|"); |
||||
if (index >= 0) { |
||||
string qualifiedName = s.Substring(0, index); |
||||
string displayName = s.Substring(index + 1); |
||||
WixCompilerExtensionName name = new WixCompilerExtensionName(qualifiedName); |
||||
name.DisplayName = displayName; |
||||
return name; |
||||
} |
||||
return new WixCompilerExtensionName(s); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using System; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
public class WixCompilerExtensionProjectItem : WixExtensionProjectItem |
||||
{ |
||||
public WixCompilerExtensionProjectItem(IProject project) : base(project) |
||||
{ |
||||
} |
||||
|
||||
public override string Tag { |
||||
get { |
||||
return "CompileExtension"; |
||||
} |
||||
} |
||||
|
||||
protected override ProjectItem CreateNewInstance(IProject project) |
||||
{ |
||||
return new WixCompilerExtensionProjectItem(project); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,75 @@
@@ -0,0 +1,75 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using System; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
/// <summary>
|
||||
/// Base class for all Wix compiler extension project items.
|
||||
/// </summary>
|
||||
public abstract class WixExtensionProjectItem : ProjectItem |
||||
{ |
||||
public WixExtensionProjectItem(IProject project) : base(project) |
||||
{ |
||||
} |
||||
|
||||
public override ItemType ItemType { |
||||
get { |
||||
return ItemType.None; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Wix extension class name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is the fully qualified class name.
|
||||
/// </remarks>
|
||||
public string ClassName { |
||||
get { |
||||
return base.Properties["Class"]; |
||||
} |
||||
set { |
||||
base.Properties["Class"] = value; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the qualified name. This updates the ClassName and the
|
||||
/// Include property.
|
||||
/// </summary>
|
||||
/// <returns>Returns "ClassName, Include" as the qualified name.</returns>
|
||||
public string QualifiedName { |
||||
get { |
||||
WixCompilerExtensionName name = new WixCompilerExtensionName(Include, ClassName); |
||||
return name.QualifiedName; |
||||
} |
||||
set { |
||||
WixCompilerExtensionName name = new WixCompilerExtensionName(value); |
||||
ClassName = name.ClassName; |
||||
Include = name.AssemblyName; |
||||
} |
||||
} |
||||
|
||||
public override ProjectItem Clone() |
||||
{ |
||||
ProjectItem n = CreateNewInstance(Project); |
||||
n.Include = Include; |
||||
this.CopyExtraPropertiesTo(n); |
||||
return n; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Derived Wix compiler extensions need to create a new instance of
|
||||
/// themselves when this method is called. This helps to have one
|
||||
/// common Clone method.
|
||||
/// </summary>
|
||||
protected abstract ProjectItem CreateNewInstance(IProject project); |
||||
} |
||||
} |
||||
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using System; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
public class WixLibraryExtensionProjectItem : WixExtensionProjectItem |
||||
{ |
||||
public WixLibraryExtensionProjectItem(IProject project) : base(project) |
||||
{ |
||||
} |
||||
|
||||
public override string Tag { |
||||
get { |
||||
return "LibExtension"; |
||||
} |
||||
} |
||||
|
||||
protected override ProjectItem CreateNewInstance(IProject project) |
||||
{ |
||||
return new WixLibraryExtensionProjectItem(project); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using System; |
||||
|
||||
namespace ICSharpCode.WixBinding |
||||
{ |
||||
public class WixLinkerExtensionProjectItem : WixExtensionProjectItem |
||||
{ |
||||
public WixLinkerExtensionProjectItem(IProject project) : base(project) |
||||
{ |
||||
} |
||||
|
||||
public override string Tag { |
||||
get { |
||||
return "LinkExtension"; |
||||
} |
||||
} |
||||
|
||||
protected override ProjectItem CreateNewInstance(IProject project) |
||||
{ |
||||
return new WixLinkerExtensionProjectItem(project); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,119 @@
@@ -0,0 +1,119 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.WixBinding; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using WixBinding.Tests.Utils; |
||||
|
||||
namespace WixBinding.Tests.Project |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that the WixProject's WixCompilerExtensions, WixLinkerExtensions and
|
||||
/// WixLibraryExtensions properties return ProjectItems.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class GetWixCompilerExtensionsTestFixture |
||||
{ |
||||
WixExtensionProjectItem compilerExtensionItem; |
||||
WixExtensionProjectItem linkerExtensionItem; |
||||
WixExtensionProjectItem libraryExtensionItem; |
||||
|
||||
[SetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
WixProject p = WixBindingTestsHelper.CreateEmptyWixProject(); |
||||
|
||||
WixCompilerExtensionProjectItem compilerItem = new WixCompilerExtensionProjectItem(p); |
||||
compilerItem.Include = "WixNetFxExtension"; |
||||
compilerItem.ClassName = "Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler"; |
||||
p.Items.Add(compilerItem); |
||||
|
||||
WixLinkerExtensionProjectItem linkerItem = new WixLinkerExtensionProjectItem(p); |
||||
linkerItem.Include = "LinkerExtension"; |
||||
linkerItem.ClassName = "LinkerExtension.ClassName"; |
||||
p.Items.Add(linkerItem); |
||||
|
||||
WixLibraryExtensionProjectItem libraryItem = new WixLibraryExtensionProjectItem(p); |
||||
libraryItem.Include = "LibraryExtension"; |
||||
libraryItem.ClassName = "LibraryExtension.ClassName"; |
||||
p.Items.Add(libraryItem); |
||||
|
||||
compilerExtensionItem = p.WixCompilerExtensions[0]; |
||||
libraryExtensionItem = p.WixLibraryExtensions[0]; |
||||
linkerExtensionItem = p.WixLinkerExtensions[0]; |
||||
} |
||||
|
||||
[Test] |
||||
public void WixCompilerExtensionItemInclude() |
||||
{ |
||||
Assert.AreEqual("WixNetFxExtension", compilerExtensionItem.Include); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsCompilerExtensionType() |
||||
{ |
||||
Assert.IsInstanceOfType(typeof(WixCompilerExtensionProjectItem), compilerExtensionItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void WixLinkerExtensionItemInclude() |
||||
{ |
||||
Assert.AreEqual("LinkerExtension", linkerExtensionItem.Include); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsLinkerExtensionType() |
||||
{ |
||||
Assert.IsInstanceOfType(typeof(WixLinkerExtensionProjectItem), linkerExtensionItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void WixLibraryExtensionItemInclude() |
||||
{ |
||||
Assert.AreEqual("LibraryExtension", libraryExtensionItem.Include); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsLibraryExtensionType() |
||||
{ |
||||
Assert.IsInstanceOfType(typeof(WixLibraryExtensionProjectItem), libraryExtensionItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetQualifiedName() |
||||
{ |
||||
Assert.AreEqual("Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension", compilerExtensionItem.QualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ChangeQualifiedName() |
||||
{ |
||||
compilerExtensionItem.QualifiedName = "class,include"; |
||||
Assert.AreEqual("include", compilerExtensionItem.Include); |
||||
Assert.AreEqual("class", compilerExtensionItem.ClassName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ChangeQualifiedNameWithNoInclude() |
||||
{ |
||||
compilerExtensionItem.QualifiedName = "class,"; |
||||
Assert.AreEqual(String.Empty, compilerExtensionItem.Include); |
||||
Assert.AreEqual("class", compilerExtensionItem.ClassName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ChangeQualifiedNameWithNoComma() |
||||
{ |
||||
compilerExtensionItem.QualifiedName = "class"; |
||||
Assert.AreEqual(String.Empty, compilerExtensionItem.Include); |
||||
Assert.AreEqual("class", compilerExtensionItem.ClassName); |
||||
Assert.AreEqual("class", compilerExtensionItem.QualifiedName); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,67 @@
@@ -0,0 +1,67 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.WixBinding; |
||||
using NUnit.Framework; |
||||
using System; |
||||
|
||||
namespace WixBinding.Tests.Project |
||||
{ |
||||
[TestFixture] |
||||
public class WixCompilerExtensionNameTests |
||||
{ |
||||
[Test] |
||||
public void DisplayName() |
||||
{ |
||||
WixCompilerExtensionName name = WixCompilerExtensionName.CreateFromString("ClassName, AssemblyName|DisplayName"); |
||||
Assert.AreEqual("DisplayName", name.DisplayName); |
||||
Assert.AreEqual("ClassName", name.ClassName); |
||||
Assert.AreEqual("AssemblyName", name.AssemblyName); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoDisplayName() |
||||
{ |
||||
WixCompilerExtensionName name = WixCompilerExtensionName.CreateFromString("ClassName, AssemblyName"); |
||||
Assert.AreEqual(String.Empty, name.DisplayName); |
||||
Assert.AreEqual("ClassName", name.ClassName); |
||||
Assert.AreEqual("AssemblyName", name.AssemblyName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExtraSpaces() |
||||
{ |
||||
WixCompilerExtensionName name = new WixCompilerExtensionName(" ClassName , AssemblyName "); |
||||
Assert.AreEqual("ClassName", name.ClassName); |
||||
Assert.AreEqual("AssemblyName", name.AssemblyName); |
||||
} |
||||
|
||||
[Test] |
||||
public void Equals() |
||||
{ |
||||
WixCompilerExtensionName name1 = new WixCompilerExtensionName("foo, bar"); |
||||
WixCompilerExtensionName name2 = new WixCompilerExtensionName("foo, bar"); |
||||
Assert.IsTrue(name1.Equals(name2)); |
||||
} |
||||
|
||||
[Test] |
||||
public void NotEqualsDifferentAssemblyName() |
||||
{ |
||||
WixCompilerExtensionName name1 = new WixCompilerExtensionName("foo"); |
||||
WixCompilerExtensionName name2 = new WixCompilerExtensionName("foo, bar"); |
||||
Assert.IsFalse(name1.Equals(name2)); |
||||
} |
||||
|
||||
[Test] |
||||
public void NotEqualsDifferentClassName() |
||||
{ |
||||
WixCompilerExtensionName name1 = new WixCompilerExtensionName("foo, bar"); |
||||
WixCompilerExtensionName name2 = new WixCompilerExtensionName("class, bar"); |
||||
Assert.IsFalse(name1.Equals(name2)); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue