Add support for multiple Operating Systems in bootstrapper

This commit is contained in:
Michael Becker 2015-04-21 14:10:09 -04:00
parent ccd48a4510
commit cd976637c6
14 changed files with 1202 additions and 152 deletions

View File

@ -12,6 +12,7 @@ namespace UniversalEditor.Dialogs.Setup.Microsoft.ACME.BootstrapScript
public BootstrapFilePropertiesDialogImpl()
{
InitializeComponent();
Font = SystemFonts.MenuFont;
}
private void cmdBrowseSourceFileName_Click(object sender, EventArgs e)

View File

@ -0,0 +1,188 @@
namespace UniversalEditor.Dialogs.Setup.Microsoft.ACME.BootstrapScript
{
partial class ManageOperatingSystemsDialogImpl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("(Platform-Independent)");
System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("Windows 95");
System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("NT Intel");
this.cmdCancel = new System.Windows.Forms.Button();
this.cmdOK = new System.Windows.Forms.Button();
this.lv = new System.Windows.Forms.ListView();
this.chTitle = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.cmdAdd = new System.Windows.Forms.Button();
this.cmdModify = new System.Windows.Forms.Button();
this.cmdRemove = new System.Windows.Forms.Button();
this.cmdClear = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// cmdCancel
//
this.cmdCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cmdCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdCancel.Location = new System.Drawing.Point(255, 146);
this.cmdCancel.Name = "cmdCancel";
this.cmdCancel.Size = new System.Drawing.Size(75, 23);
this.cmdCancel.TabIndex = 2;
this.cmdCancel.Text = "&Cancel";
this.cmdCancel.UseVisualStyleBackColor = true;
this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
//
// cmdOK
//
this.cmdOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cmdOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdOK.Location = new System.Drawing.Point(174, 146);
this.cmdOK.Name = "cmdOK";
this.cmdOK.Size = new System.Drawing.Size(75, 23);
this.cmdOK.TabIndex = 1;
this.cmdOK.Text = "&OK";
this.cmdOK.UseVisualStyleBackColor = true;
this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
//
// lv
//
this.lv.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.lv.CheckBoxes = true;
this.lv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chTitle});
this.lv.FullRowSelect = true;
this.lv.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lv.HideSelection = false;
listViewItem1.Checked = true;
listViewItem1.StateImageIndex = 1;
listViewItem2.Checked = true;
listViewItem2.StateImageIndex = 1;
listViewItem3.Checked = true;
listViewItem3.StateImageIndex = 1;
this.lv.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem1,
listViewItem2,
listViewItem3});
this.lv.Location = new System.Drawing.Point(12, 41);
this.lv.Name = "lv";
this.lv.Size = new System.Drawing.Size(318, 99);
this.lv.TabIndex = 0;
this.lv.UseCompatibleStateImageBehavior = false;
this.lv.View = System.Windows.Forms.View.Details;
this.lv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lv_ItemChecked);
this.lv.SelectedIndexChanged += new System.EventHandler(this.lv_SelectedIndexChanged);
//
// chTitle
//
this.chTitle.Text = "Title";
this.chTitle.Width = 309;
//
// cmdAdd
//
this.cmdAdd.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdAdd.Location = new System.Drawing.Point(12, 12);
this.cmdAdd.Name = "cmdAdd";
this.cmdAdd.Size = new System.Drawing.Size(75, 23);
this.cmdAdd.TabIndex = 3;
this.cmdAdd.Text = "&Add...";
this.cmdAdd.UseVisualStyleBackColor = true;
this.cmdAdd.Click += new System.EventHandler(this.cmdAdd_Click);
//
// cmdModify
//
this.cmdModify.Enabled = false;
this.cmdModify.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdModify.Location = new System.Drawing.Point(93, 12);
this.cmdModify.Name = "cmdModify";
this.cmdModify.Size = new System.Drawing.Size(75, 23);
this.cmdModify.TabIndex = 3;
this.cmdModify.Text = "&Modify...";
this.cmdModify.UseVisualStyleBackColor = true;
this.cmdModify.Click += new System.EventHandler(this.cmdModify_Click);
//
// cmdRemove
//
this.cmdRemove.Enabled = false;
this.cmdRemove.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdRemove.Location = new System.Drawing.Point(174, 12);
this.cmdRemove.Name = "cmdRemove";
this.cmdRemove.Size = new System.Drawing.Size(75, 23);
this.cmdRemove.TabIndex = 3;
this.cmdRemove.Text = "&Remove...";
this.cmdRemove.UseVisualStyleBackColor = true;
this.cmdRemove.Click += new System.EventHandler(this.cmdRemove_Click);
//
// cmdClear
//
this.cmdClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmdClear.Enabled = false;
this.cmdClear.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdClear.Location = new System.Drawing.Point(255, 12);
this.cmdClear.Name = "cmdClear";
this.cmdClear.Size = new System.Drawing.Size(75, 23);
this.cmdClear.TabIndex = 3;
this.cmdClear.Text = "Cl&ear";
this.cmdClear.UseVisualStyleBackColor = true;
this.cmdClear.Click += new System.EventHandler(this.cmdClear_Click);
//
// ManageOperatingSystemsDialogImpl
//
this.AcceptButton = this.cmdOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cmdCancel;
this.ClientSize = new System.Drawing.Size(342, 181);
this.Controls.Add(this.cmdClear);
this.Controls.Add(this.cmdRemove);
this.Controls.Add(this.cmdModify);
this.Controls.Add(this.cmdAdd);
this.Controls.Add(this.lv);
this.Controls.Add(this.cmdOK);
this.Controls.Add(this.cmdCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(358, 219);
this.Name = "ManageOperatingSystemsDialogImpl";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Manage Operating Systems";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button cmdCancel;
private System.Windows.Forms.Button cmdOK;
private System.Windows.Forms.ListView lv;
private System.Windows.Forms.ColumnHeader chTitle;
private System.Windows.Forms.Button cmdAdd;
private System.Windows.Forms.Button cmdModify;
private System.Windows.Forms.Button cmdRemove;
private System.Windows.Forms.Button cmdClear;
}
}

View File

@ -0,0 +1,169 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript;
namespace UniversalEditor.Dialogs.Setup.Microsoft.ACME.BootstrapScript
{
internal partial class ManageOperatingSystemsDialogImpl : Form
{
public ManageOperatingSystemsDialogImpl()
{
InitializeComponent();
Font = SystemFonts.MenuFont;
}
private BootstrapOperatingSystem.BootstrapOperatingSystemCollection mvarOperatingSystems = new BootstrapOperatingSystem.BootstrapOperatingSystemCollection();
public BootstrapOperatingSystem.BootstrapOperatingSystemCollection OperatingSystems { get { return mvarOperatingSystems; } }
private void cmdOK_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
private void cmdCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
lv.Items.Clear();
if (mvarOperatingSystems.Count == 0)
{
mvarOperatingSystems.Add(BootstrapOperatingSystem.PlatformIndependent);
}
foreach (BootstrapOperatingSystem item in mvarOperatingSystems)
{
ListViewItem lvi = new ListViewItem();
lvi.Checked = item.Enabled;
lvi.Text = item.Name;
lvi.Tag = item;
lv.Items.Add(lvi);
}
}
private void cmdAdd_Click(object sender, EventArgs e)
{
OperatingSystemPropertiesDialog dlg = new OperatingSystemPropertiesDialog();
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
BootstrapOperatingSystem item = new BootstrapOperatingSystem();
item.Name = dlg.Name;
item.Enabled = dlg.Enabled;
mvarOperatingSystems.Add(item);
ListViewItem lvi = new ListViewItem();
lvi.Checked = item.Enabled;
lvi.Text = item.Name;
lvi.Tag = item;
lv.Items.Add(lvi);
RefreshButtons();
}
}
private void cmdModify_Click(object sender, EventArgs e)
{
if (lv.SelectedItems.Count != 1) return;
OperatingSystemPropertiesDialog dlg = new OperatingSystemPropertiesDialog();
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
}
}
private void cmdRemove_Click(object sender, EventArgs e)
{
if (lv.SelectedItems.Count == 0) return;
if (MessageBox.Show("Removing operating systems from the list will delete their associated settings.\r\n\r\nAre you sure you want to remove the selected operating systems and clear their associated settings?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No)
{
return;
}
while (lv.SelectedItems.Count > 0)
{
lv.SelectedItems[0].Remove();
}
RefreshButtons();
}
private void cmdClear_Click(object sender, EventArgs e)
{
if (lv.Items.Count == 0) return;
if (MessageBox.Show("Removing operating systems from the list will delete their associated settings.\r\n\r\nAre you sure you want to remove ALL operating systems and clear their associated settings?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No)
{
return;
}
lv.Items.Clear();
RefreshButtons();
}
private void RefreshButtons()
{
cmdModify.Enabled = (lv.SelectedItems.Count == 1);
cmdRemove.Enabled = (lv.SelectedItems.Count > 0);
cmdClear.Enabled = (lv.Items.Count > 1);
if (lv.SelectedItems.Count > 0)
{
if (lv.SelectedItems[0].Tag == BootstrapOperatingSystem.PlatformIndependent)
{
cmdModify.Enabled = false;
cmdRemove.Enabled = false;
}
}
}
private void lv_SelectedIndexChanged(object sender, EventArgs e)
{
RefreshButtons();
}
private void lv_ItemChecked(object sender, ItemCheckedEventArgs e)
{
BootstrapOperatingSystem item = (e.Item.Tag as BootstrapOperatingSystem);
if (item == null) return;
item.Enabled = e.Item.Checked;
}
}
public class ManageOperatingSystemsDialog
{
private BootstrapOperatingSystem.BootstrapOperatingSystemCollection mvarOperatingSystems = new BootstrapOperatingSystem.BootstrapOperatingSystemCollection();
public BootstrapOperatingSystem.BootstrapOperatingSystemCollection OperatingSystems { get { return mvarOperatingSystems; } }
public DialogResult ShowDialog()
{
ManageOperatingSystemsDialogImpl dlg = new ManageOperatingSystemsDialogImpl();
foreach (BootstrapOperatingSystem item in mvarOperatingSystems)
{
dlg.OperatingSystems.Add(item);
}
if (dlg.ShowDialog() == DialogResult.OK)
{
mvarOperatingSystems.Clear();
foreach (BootstrapOperatingSystem item in dlg.OperatingSystems)
{
mvarOperatingSystems.Add(item);
}
return DialogResult.OK;
}
return DialogResult.Cancel;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,126 @@
namespace UniversalEditor.Dialogs.Setup.Microsoft.ACME.BootstrapScript
{
partial class OperatingSystemPropertiesDialogImpl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblName = new System.Windows.Forms.Label();
this.txtName = new System.Windows.Forms.TextBox();
this.cmdCancel = new System.Windows.Forms.Button();
this.cmdOK = new System.Windows.Forms.Button();
this.chkEnabled = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// lblName
//
this.lblName.AutoSize = true;
this.lblName.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.lblName.Location = new System.Drawing.Point(12, 15);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(38, 13);
this.lblName.TabIndex = 0;
this.lblName.Text = "&Name:";
//
// txtName
//
this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtName.Location = new System.Drawing.Point(56, 12);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(283, 20);
this.txtName.TabIndex = 1;
//
// cmdCancel
//
this.cmdCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cmdCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdCancel.Location = new System.Drawing.Point(264, 73);
this.cmdCancel.Name = "cmdCancel";
this.cmdCancel.Size = new System.Drawing.Size(75, 23);
this.cmdCancel.TabIndex = 4;
this.cmdCancel.Text = "&Cancel";
this.cmdCancel.UseVisualStyleBackColor = true;
this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
//
// cmdOK
//
this.cmdOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cmdOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdOK.Location = new System.Drawing.Point(183, 73);
this.cmdOK.Name = "cmdOK";
this.cmdOK.Size = new System.Drawing.Size(75, 23);
this.cmdOK.TabIndex = 3;
this.cmdOK.Text = "&OK";
this.cmdOK.UseVisualStyleBackColor = true;
this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
//
// chkEnabled
//
this.chkEnabled.AutoSize = true;
this.chkEnabled.Checked = true;
this.chkEnabled.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkEnabled.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.chkEnabled.Location = new System.Drawing.Point(56, 38);
this.chkEnabled.Name = "chkEnabled";
this.chkEnabled.Size = new System.Drawing.Size(71, 18);
this.chkEnabled.TabIndex = 2;
this.chkEnabled.Text = "&Enabled";
this.chkEnabled.UseVisualStyleBackColor = true;
//
// OperatingSystemPropertiesDialogImpl
//
this.AcceptButton = this.cmdOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cmdCancel;
this.ClientSize = new System.Drawing.Size(351, 108);
this.Controls.Add(this.chkEnabled);
this.Controls.Add(this.cmdOK);
this.Controls.Add(this.cmdCancel);
this.Controls.Add(this.txtName);
this.Controls.Add(this.lblName);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "OperatingSystemPropertiesDialogImpl";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Operating System Properties";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.Button cmdCancel;
private System.Windows.Forms.Button cmdOK;
internal System.Windows.Forms.TextBox txtName;
internal System.Windows.Forms.CheckBox chkEnabled;
}
}

View File

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace UniversalEditor.Dialogs.Setup.Microsoft.ACME.BootstrapScript
{
internal partial class OperatingSystemPropertiesDialogImpl : Form
{
public OperatingSystemPropertiesDialogImpl()
{
InitializeComponent();
}
private void cmdOK_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(txtName.Text))
{
MessageBox.Show("Please enter a name for this operating system.", "Enter Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
private void cmdCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
}
public class OperatingSystemPropertiesDialog
{
private string mvarName = String.Empty;
public string Name { get { return mvarName; } set { mvarName = value; } }
private bool mvarEnabled = true;
public bool Enabled { get { return mvarEnabled; } set { mvarEnabled = value; } }
public DialogResult ShowDialog()
{
OperatingSystemPropertiesDialogImpl dlg = new OperatingSystemPropertiesDialogImpl();
dlg.txtName.Text = mvarName;
dlg.chkEnabled.Checked = mvarEnabled;
if (dlg.ShowDialog() == DialogResult.OK)
{
mvarName = dlg.txtName.Text;
mvarEnabled = dlg.chkEnabled.Checked;
return DialogResult.OK;
}
return DialogResult.Cancel;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -53,6 +53,9 @@
this.lvFiles = new System.Windows.Forms.ListView();
this.chSource = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chDestination = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lblOperatingSystem = new System.Windows.Forms.Label();
this.cboOperatingSystem = new System.Windows.Forms.ComboBox();
this.cmdManageOperatingSystems = new System.Windows.Forms.Button();
this.fraGeneral.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.txtTemporaryDirectorySize)).BeginInit();
@ -80,10 +83,10 @@
this.fraGeneral.Controls.Add(this.txtWindowTitle);
this.fraGeneral.Controls.Add(this.lblWindowTitle);
this.fraGeneral.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.fraGeneral.Location = new System.Drawing.Point(4, 4);
this.fraGeneral.Location = new System.Drawing.Point(4, 32);
this.fraGeneral.Name = "fraGeneral";
this.fraGeneral.Size = new System.Drawing.Size(479, 208);
this.fraGeneral.TabIndex = 0;
this.fraGeneral.TabIndex = 3;
this.fraGeneral.TabStop = false;
this.fraGeneral.Text = "General";
//
@ -103,7 +106,7 @@
this.chkRequire31.Location = new System.Drawing.Point(19, 149);
this.chkRequire31.Name = "chkRequire31";
this.chkRequire31.Size = new System.Drawing.Size(134, 18);
this.chkRequire31.TabIndex = 3;
this.chkRequire31.TabIndex = 12;
this.chkRequire31.Text = "&Require Windows 3.1";
this.chkRequire31.UseVisualStyleBackColor = true;
this.chkRequire31.CheckedChanged += new System.EventHandler(this.chkRequire31_CheckedChanged);
@ -119,7 +122,7 @@
0});
this.txtTemporaryDirectorySize.Name = "txtTemporaryDirectorySize";
this.txtTemporaryDirectorySize.Size = new System.Drawing.Size(68, 20);
this.txtTemporaryDirectorySize.TabIndex = 2;
this.txtTemporaryDirectorySize.TabIndex = 9;
this.txtTemporaryDirectorySize.Value = new decimal(new int[] {
3200,
0,
@ -134,7 +137,7 @@
this.txtTemporaryDirectoryName.Location = new System.Drawing.Point(154, 96);
this.txtTemporaryDirectoryName.Name = "txtTemporaryDirectoryName";
this.txtTemporaryDirectoryName.Size = new System.Drawing.Size(209, 20);
this.txtTemporaryDirectoryName.TabIndex = 1;
this.txtTemporaryDirectoryName.TabIndex = 7;
this.txtTemporaryDirectoryName.Text = "~msstfqf.t";
this.txtTemporaryDirectoryName.Validated += new System.EventHandler(this.txtTemporaryDirectoryName_Validated);
//
@ -146,7 +149,7 @@
this.txtRequire31.Name = "txtRequire31";
this.txtRequire31.ReadOnly = true;
this.txtRequire31.Size = new System.Drawing.Size(319, 20);
this.txtRequire31.TabIndex = 1;
this.txtRequire31.TabIndex = 14;
this.txtRequire31.Text = "This application requires a newer version of Microsoft Windows.";
this.txtRequire31.Validated += new System.EventHandler(this.txtRequire31_Validated);
//
@ -157,7 +160,7 @@
this.txtCommandLine.Location = new System.Drawing.Point(154, 123);
this.txtCommandLine.Name = "txtCommandLine";
this.txtCommandLine.Size = new System.Drawing.Size(319, 20);
this.txtCommandLine.TabIndex = 1;
this.txtCommandLine.TabIndex = 11;
this.txtCommandLine.Text = "acmsetup /T setup.stf";
this.txtCommandLine.Validated += new System.EventHandler(this.txtCommandLine_Validated);
//
@ -168,7 +171,7 @@
this.txtWindowClassName.Location = new System.Drawing.Point(154, 71);
this.txtWindowClassName.Name = "txtWindowClassName";
this.txtWindowClassName.Size = new System.Drawing.Size(319, 20);
this.txtWindowClassName.TabIndex = 1;
this.txtWindowClassName.TabIndex = 5;
this.txtWindowClassName.Text = "Stuff-Shell";
this.txtWindowClassName.Validated += new System.EventHandler(this.txtWindowClassName_Validated);
//
@ -179,7 +182,7 @@
this.txtWindowMessage.Location = new System.Drawing.Point(154, 45);
this.txtWindowMessage.Name = "txtWindowMessage";
this.txtWindowMessage.Size = new System.Drawing.Size(319, 20);
this.txtWindowMessage.TabIndex = 1;
this.txtWindowMessage.TabIndex = 3;
this.txtWindowMessage.Text = "Initializing Setup...";
this.txtWindowMessage.Validated += new System.EventHandler(this.txtWindowMessage_Validated);
//
@ -191,7 +194,7 @@
this.lblRequire31.Location = new System.Drawing.Point(51, 175);
this.lblRequire31.Name = "lblRequire31";
this.lblRequire31.Size = new System.Drawing.Size(77, 13);
this.lblRequire31.TabIndex = 0;
this.lblRequire31.TabIndex = 13;
this.lblRequire31.Text = "Error &message:";
//
// lblTemporaryDirectorySize
@ -202,7 +205,7 @@
this.lblTemporaryDirectorySize.Location = new System.Drawing.Point(369, 99);
this.lblTemporaryDirectorySize.Name = "lblTemporaryDirectorySize";
this.lblTemporaryDirectorySize.Size = new System.Drawing.Size(30, 13);
this.lblTemporaryDirectorySize.TabIndex = 0;
this.lblTemporaryDirectorySize.TabIndex = 8;
this.lblTemporaryDirectorySize.Text = "&Size:";
//
// lblCommandLine
@ -212,7 +215,7 @@
this.lblCommandLine.Location = new System.Drawing.Point(16, 126);
this.lblCommandLine.Name = "lblCommandLine";
this.lblCommandLine.Size = new System.Drawing.Size(76, 13);
this.lblCommandLine.TabIndex = 0;
this.lblCommandLine.TabIndex = 10;
this.lblCommandLine.Text = "&Command line:";
//
// lblWindowClassName
@ -222,7 +225,7 @@
this.lblWindowClassName.Location = new System.Drawing.Point(16, 74);
this.lblWindowClassName.Name = "lblWindowClassName";
this.lblWindowClassName.Size = new System.Drawing.Size(105, 13);
this.lblWindowClassName.TabIndex = 0;
this.lblWindowClassName.TabIndex = 4;
this.lblWindowClassName.Text = "Window class &name:";
//
// lblTemporaryDirectoryName
@ -232,7 +235,7 @@
this.lblTemporaryDirectoryName.Location = new System.Drawing.Point(16, 99);
this.lblTemporaryDirectoryName.Name = "lblTemporaryDirectoryName";
this.lblTemporaryDirectoryName.Size = new System.Drawing.Size(132, 13);
this.lblTemporaryDirectoryName.TabIndex = 0;
this.lblTemporaryDirectoryName.TabIndex = 6;
this.lblTemporaryDirectoryName.Text = "&Temporary directory name:";
//
// lblWindowMessage
@ -242,8 +245,8 @@
this.lblWindowMessage.Location = new System.Drawing.Point(53, 48);
this.lblWindowMessage.Name = "lblWindowMessage";
this.lblWindowMessage.Size = new System.Drawing.Size(94, 13);
this.lblWindowMessage.TabIndex = 0;
this.lblWindowMessage.Text = "Window &message:";
this.lblWindowMessage.TabIndex = 2;
this.lblWindowMessage.Text = "&Window message:";
//
// txtWindowTitle
//
@ -277,10 +280,10 @@
this.fraFiles.Controls.Add(this.cmdFilesAdd);
this.fraFiles.Controls.Add(this.lvFiles);
this.fraFiles.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.fraFiles.Location = new System.Drawing.Point(4, 218);
this.fraFiles.Location = new System.Drawing.Point(4, 246);
this.fraFiles.Name = "fraFiles";
this.fraFiles.Size = new System.Drawing.Size(473, 171);
this.fraFiles.TabIndex = 1;
this.fraFiles.Size = new System.Drawing.Size(473, 143);
this.fraFiles.TabIndex = 4;
this.fraFiles.TabStop = false;
this.fraFiles.Text = "Files";
//
@ -292,7 +295,7 @@
this.cmdFilesClear.Location = new System.Drawing.Point(392, 19);
this.cmdFilesClear.Name = "cmdFilesClear";
this.cmdFilesClear.Size = new System.Drawing.Size(75, 23);
this.cmdFilesClear.TabIndex = 1;
this.cmdFilesClear.TabIndex = 3;
this.cmdFilesClear.Text = "Cl&ear";
this.cmdFilesClear.UseVisualStyleBackColor = true;
this.cmdFilesClear.Click += new System.EventHandler(this.cmdFilesClear_Click);
@ -304,7 +307,7 @@
this.cmdFilesRemove.Location = new System.Drawing.Point(168, 19);
this.cmdFilesRemove.Name = "cmdFilesRemove";
this.cmdFilesRemove.Size = new System.Drawing.Size(75, 23);
this.cmdFilesRemove.TabIndex = 1;
this.cmdFilesRemove.TabIndex = 2;
this.cmdFilesRemove.Text = "&Remove";
this.cmdFilesRemove.UseVisualStyleBackColor = true;
this.cmdFilesRemove.Click += new System.EventHandler(this.cmdFilesRemove_Click);
@ -317,7 +320,7 @@
this.cmdFilesModify.Name = "cmdFilesModify";
this.cmdFilesModify.Size = new System.Drawing.Size(75, 23);
this.cmdFilesModify.TabIndex = 1;
this.cmdFilesModify.Text = "&Modify...";
this.cmdFilesModify.Text = "Mo&dify...";
this.cmdFilesModify.UseVisualStyleBackColor = true;
this.cmdFilesModify.Click += new System.EventHandler(this.cmdFilesModify_Click);
//
@ -327,7 +330,7 @@
this.cmdFilesAdd.Location = new System.Drawing.Point(6, 19);
this.cmdFilesAdd.Name = "cmdFilesAdd";
this.cmdFilesAdd.Size = new System.Drawing.Size(75, 23);
this.cmdFilesAdd.TabIndex = 1;
this.cmdFilesAdd.TabIndex = 0;
this.cmdFilesAdd.Text = "&Add...";
this.cmdFilesAdd.UseVisualStyleBackColor = true;
this.cmdFilesAdd.Click += new System.EventHandler(this.cmdFilesAdd_Click);
@ -343,8 +346,8 @@
this.lvFiles.HideSelection = false;
this.lvFiles.Location = new System.Drawing.Point(6, 48);
this.lvFiles.Name = "lvFiles";
this.lvFiles.Size = new System.Drawing.Size(461, 117);
this.lvFiles.TabIndex = 0;
this.lvFiles.Size = new System.Drawing.Size(461, 89);
this.lvFiles.TabIndex = 4;
this.lvFiles.UseCompatibleStateImageBehavior = false;
this.lvFiles.View = System.Windows.Forms.View.Details;
this.lvFiles.ItemActivate += new System.EventHandler(this.lvFiles_ItemActivate);
@ -360,10 +363,51 @@
this.chDestination.Text = "Destination";
this.chDestination.Width = 287;
//
// lblOperatingSystem
//
this.lblOperatingSystem.AutoSize = true;
this.lblOperatingSystem.Location = new System.Drawing.Point(7, 8);
this.lblOperatingSystem.Name = "lblOperatingSystem";
this.lblOperatingSystem.Size = new System.Drawing.Size(91, 13);
this.lblOperatingSystem.TabIndex = 0;
this.lblOperatingSystem.Text = "&Operating system:";
//
// cboOperatingSystem
//
this.cboOperatingSystem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cboOperatingSystem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboOperatingSystem.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cboOperatingSystem.FormattingEnabled = true;
this.cboOperatingSystem.Items.AddRange(new object[] {
"(Platform-Independent)",
"Windows 95",
"NT Intel"});
this.cboOperatingSystem.Location = new System.Drawing.Point(104, 5);
this.cboOperatingSystem.Name = "cboOperatingSystem";
this.cboOperatingSystem.Size = new System.Drawing.Size(298, 21);
this.cboOperatingSystem.TabIndex = 1;
this.cboOperatingSystem.SelectedIndexChanged += new System.EventHandler(this.cboOperatingSystem_SelectedIndexChanged);
//
// cmdManageOperatingSystems
//
this.cmdManageOperatingSystems.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmdManageOperatingSystems.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cmdManageOperatingSystems.Location = new System.Drawing.Point(408, 3);
this.cmdManageOperatingSystems.Name = "cmdManageOperatingSystems";
this.cmdManageOperatingSystems.Size = new System.Drawing.Size(75, 23);
this.cmdManageOperatingSystems.TabIndex = 2;
this.cmdManageOperatingSystems.Text = "Ma&nage...";
this.cmdManageOperatingSystems.UseVisualStyleBackColor = true;
this.cmdManageOperatingSystems.Click += new System.EventHandler(this.cmdManageOperatingSystems_Click);
//
// BootstrapScriptEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cmdManageOperatingSystems);
this.Controls.Add(this.cboOperatingSystem);
this.Controls.Add(this.lblOperatingSystem);
this.Controls.Add(this.fraFiles);
this.Controls.Add(this.fraGeneral);
this.MinimumSize = new System.Drawing.Size(486, 392);
@ -375,6 +419,7 @@
((System.ComponentModel.ISupportInitialize)(this.txtTemporaryDirectorySize)).EndInit();
this.fraFiles.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
@ -405,5 +450,8 @@
private System.Windows.Forms.Button cmdFilesModify;
private System.Windows.Forms.Button cmdFilesAdd;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label lblOperatingSystem;
private System.Windows.Forms.ComboBox cboOperatingSystem;
private System.Windows.Forms.Button cmdManageOperatingSystems;
}
}

View File

@ -18,6 +18,7 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
public BootstrapScriptEditor()
{
InitializeComponent();
cboOperatingSystem.SelectedIndex = 0;
}
private static EditorReference _er = null;
@ -41,7 +42,11 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
if (script == null) return;
BeginEdit();
script.Require31Enabled = chkRequire31.Checked;
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.Require31Enabled = chkRequire31.Checked;
}
EndEdit();
}
@ -52,17 +57,15 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
BootstrapScriptObjectModel script = (ObjectModel as BootstrapScriptObjectModel);
if (script == null) script = new BootstrapScriptObjectModel();
txtWindowTitle.Text = script.WindowTitle;
txtWindowMessage.Text = script.WindowMessage;
txtTemporaryDirectorySize.Value = script.TemporaryDirectorySize;
txtTemporaryDirectoryName.Text = script.TemporaryDirectoryName;
txtCommandLine.Text = script.CommandLine;
txtWindowClassName.Text = script.WindowClassName;
chkRequire31.Checked = script.Require31Enabled;
txtRequire31.ReadOnly = !script.Require31Enabled;
txtRequire31.Text = script.Require31Message;
lblRequire31.Enabled = script.Require31Enabled;
cboOperatingSystem.Items.Clear();
foreach (BootstrapOperatingSystem item in script.OperatingSystems)
{
cboOperatingSystem.Items.Add(item);
}
if (cboOperatingSystem.Items.Count > 0)
{
cboOperatingSystem.SelectedIndex = 0;
}
}
private void txtWindowTitle_TextChanged(object sender, EventArgs e)
@ -81,7 +84,11 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
if (script == null) return;
BeginEdit();
script.WindowTitle = txtWindowTitle.Text;
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.WindowTitle = txtWindowTitle.Text;
}
EndEdit();
}
@ -91,7 +98,11 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
if (script == null) return;
BeginEdit();
script.WindowMessage = txtWindowMessage.Text;
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.WindowMessage = txtWindowMessage.Text;
}
EndEdit();
}
@ -101,7 +112,11 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
if (script == null) return;
BeginEdit();
script.WindowClassName = txtWindowClassName.Text;
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.WindowClassName = txtWindowClassName.Text;
}
EndEdit();
}
@ -111,7 +126,11 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
if (script == null) return;
BeginEdit();
script.TemporaryDirectoryName = txtTemporaryDirectoryName.Text;
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.TemporaryDirectoryName = txtTemporaryDirectoryName.Text;
}
EndEdit();
}
@ -121,7 +140,11 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
if (script == null) return;
BeginEdit();
script.TemporaryDirectorySize = (int)txtTemporaryDirectorySize.Value;
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.TemporaryDirectorySize = (int)txtTemporaryDirectorySize.Value;
}
EndEdit();
}
@ -131,7 +154,11 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
if (script == null) return;
BeginEdit();
script.CommandLine = txtCommandLine.Text;
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.CommandLine = txtCommandLine.Text;
}
EndEdit();
}
@ -141,7 +168,13 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
if (script == null) return;
BeginEdit();
script.Require31Message = txtRequire31.Text;
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.Require31Message = txtRequire31.Text;
}
EndEdit();
}
@ -157,7 +190,13 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
BootstrapScriptObjectModel script = (ObjectModel as BootstrapScriptObjectModel);
BeginEdit();
script.Files.Add(file);
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.Files.Add(file);
}
EndEdit();
lvi.Tag = file;
@ -201,9 +240,14 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
BootstrapScriptObjectModel script = (ObjectModel as BootstrapScriptObjectModel);
BeginEdit();
foreach (ListViewItem lvi in lvFiles.SelectedItems)
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
script.Files.Remove(lvi.Tag as BootstrapFile);
foreach (ListViewItem lvi in lvFiles.SelectedItems)
{
item.Files.Remove(lvi.Tag as BootstrapFile);
}
}
EndEdit();
@ -228,7 +272,13 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
BootstrapScriptObjectModel script = (ObjectModel as BootstrapScriptObjectModel);
BeginEdit();
script.Files.Clear();
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
item.Files.Clear();
}
EndEdit();
}
@ -241,5 +291,48 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript
{
RefreshButtons();
}
private void cmdManageOperatingSystems_Click(object sender, EventArgs e)
{
BootstrapScriptObjectModel script = (ObjectModel as BootstrapScriptObjectModel);
if (script == null) return;
ManageOperatingSystemsDialog dlg = new ManageOperatingSystemsDialog();
foreach (BootstrapOperatingSystem item in script.OperatingSystems)
{
dlg.OperatingSystems.Add(item);
}
if (dlg.ShowDialog() == DialogResult.OK)
{
script.OperatingSystems.Clear();
cboOperatingSystem.Items.Clear();
foreach (BootstrapOperatingSystem item in dlg.OperatingSystems)
{
script.OperatingSystems.Add(item);
if (item.Enabled) cboOperatingSystem.Items.Add(item);
}
if (cboOperatingSystem.SelectedIndex == -1 && cboOperatingSystem.Items.Count > 0) cboOperatingSystem.SelectedIndex = 0;
}
}
private void cboOperatingSystem_SelectedIndexChanged(object sender, EventArgs e)
{
BootstrapOperatingSystem item = (cboOperatingSystem.SelectedItem as BootstrapOperatingSystem);
if (item != null)
{
txtWindowTitle.Text = item.WindowTitle;
txtWindowMessage.Text = item.WindowMessage;
txtTemporaryDirectorySize.Value = item.TemporaryDirectorySize;
txtTemporaryDirectoryName.Text = item.TemporaryDirectoryName;
txtCommandLine.Text = item.CommandLine;
txtWindowClassName.Text = item.WindowClassName;
chkRequire31.Checked = item.Require31Enabled;
txtRequire31.ReadOnly = !item.Require31Enabled;
txtRequire31.Text = item.Require31Message;
lblRequire31.Enabled = item.Require31Enabled;
}
}
}
}

View File

@ -43,6 +43,18 @@
<Compile Include="Dialogs\Setup\Microsoft\ACME\BootstrapScript\BootstrapFilePropertiesDialog.Designer.cs">
<DependentUpon>BootstrapFilePropertiesDialog.cs</DependentUpon>
</Compile>
<Compile Include="Dialogs\Setup\Microsoft\ACME\BootstrapScript\ManageOperatingSystemsDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialogs\Setup\Microsoft\ACME\BootstrapScript\ManageOperatingSystemsDialog.Designer.cs">
<DependentUpon>ManageOperatingSystemsDialog.cs</DependentUpon>
</Compile>
<Compile Include="Dialogs\Setup\Microsoft\ACME\BootstrapScript\OperatingSystemPropertiesDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialogs\Setup\Microsoft\ACME\BootstrapScript\OperatingSystemPropertiesDialog.Designer.cs">
<DependentUpon>OperatingSystemPropertiesDialog.cs</DependentUpon>
</Compile>
<Compile Include="Editors\Setup\Microsoft\ACME\BootstrapScript\BootstrapScriptEditor.cs">
<SubType>UserControl</SubType>
</Compile>
@ -82,6 +94,12 @@
<EmbeddedResource Include="Dialogs\Setup\Microsoft\ACME\BootstrapScript\BootstrapFilePropertiesDialog.resx">
<DependentUpon>BootstrapFilePropertiesDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Dialogs\Setup\Microsoft\ACME\BootstrapScript\ManageOperatingSystemsDialog.resx">
<DependentUpon>ManageOperatingSystemsDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Dialogs\Setup\Microsoft\ACME\BootstrapScript\OperatingSystemPropertiesDialog.resx">
<DependentUpon>OperatingSystemPropertiesDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\Setup\Microsoft\ACME\BootstrapScript\BootstrapScriptEditor.resx">
<DependentUpon>BootstrapScriptEditor.cs</DependentUpon>
</EmbeddedResource>

View File

@ -39,26 +39,50 @@ namespace UniversalEditor.DataFormats.Setup.Microsoft.ACME.BootstrapScript
PropertyListObjectModel plom = (objectModels.Pop() as PropertyListObjectModel);
BootstrapScriptObjectModel script = (objectModels.Pop() as BootstrapScriptObjectModel);
Group grpParams = plom.Groups["Params"];
if (grpParams == null) throw new InvalidDataFormatException("File does not contain a 'Params' section");
Group grpFiles = plom.Groups["Files"];
if (grpFiles == null) throw new InvalidDataFormatException("File does not contain a 'Files' section");
if (grpParams.Properties.Contains("WndTitle")) script.WindowTitle = grpParams.Properties["WndTitle"].Value.ToString();
if (grpParams.Properties.Contains("WndMess")) script.WindowMessage = grpParams.Properties["WndMess"].Value.ToString();
if (grpParams.Properties.Contains("TmpDirSize")) script.TemporaryDirectorySize = Int32.Parse(grpParams.Properties["TmpDirSize"].Value.ToString());
if (grpParams.Properties.Contains("TmpDirName")) script.TemporaryDirectoryName = grpParams.Properties["TmpDirName"].Value.ToString();
if (grpParams.Properties.Contains("CmdLine")) script.CommandLine = grpParams.Properties["CmdLine"].Value.ToString();
if (grpParams.Properties.Contains("DrvWinClass")) script.WindowClassName = grpParams.Properties["DrvWinClass"].Value.ToString();
if (grpParams.Properties.Contains("Require31"))
foreach (Group grp in plom.Groups)
{
script.Require31Enabled = true;
script.Require31Message = grpParams.Properties["Require31"].Value.ToString();
}
foreach (Property p in grpFiles.Properties)
{
script.Files.Add(p.Name, p.Value.ToString());
BootstrapOperatingSystem operatingSystem = null;
if (grp.Name == "Params" || grp.Name.EndsWith(" Params"))
{
if (grp.Name == "Params")
{
operatingSystem = BootstrapOperatingSystem.PlatformIndependent;
}
else
{
string operatingSystemName = grp.Name.Substring(0, grp.Name.Length - " Params".Length);
operatingSystem = script.OperatingSystems.AddOrRetrieve(operatingSystemName);
}
if (grp.Properties.Contains("WndTitle")) operatingSystem.WindowTitle = grp.Properties["WndTitle"].Value.ToString();
if (grp.Properties.Contains("WndMess")) operatingSystem.WindowMessage = grp.Properties["WndMess"].Value.ToString();
if (grp.Properties.Contains("TmpDirSize")) operatingSystem.TemporaryDirectorySize = Int32.Parse(grp.Properties["TmpDirSize"].Value.ToString());
if (grp.Properties.Contains("TmpDirName")) operatingSystem.TemporaryDirectoryName = grp.Properties["TmpDirName"].Value.ToString();
if (grp.Properties.Contains("CmdLine")) operatingSystem.CommandLine = grp.Properties["CmdLine"].Value.ToString();
if (grp.Properties.Contains("DrvWinClass")) operatingSystem.WindowClassName = grp.Properties["DrvWinClass"].Value.ToString();
if (grp.Properties.Contains("Require31"))
{
operatingSystem.Require31Enabled = true;
operatingSystem.Require31Message = grp.Properties["Require31"].Value.ToString();
}
}
else if (grp.Name == "Files" || grp.Name.EndsWith(" Files"))
{
if (grp.Name == "Files")
{
operatingSystem = BootstrapOperatingSystem.PlatformIndependent;
}
else
{
string operatingSystemName = grp.Name.Substring(0, grp.Name.Length - " Files".Length);
operatingSystem = script.OperatingSystems.AddOrRetrieve(operatingSystemName);
}
foreach (Property p in grp.Properties)
{
operatingSystem.Files.Add(p.Name, p.Value.ToString());
}
}
}
}
protected override void BeforeSaveInternal(Stack<ObjectModel> objectModels)
@ -68,25 +92,37 @@ namespace UniversalEditor.DataFormats.Setup.Microsoft.ACME.BootstrapScript
BootstrapScriptObjectModel script = (objectModels.Pop() as BootstrapScriptObjectModel);
PropertyListObjectModel plom = new PropertyListObjectModel();
Group grpParams = new Group("Params");
grpParams.Properties.Add("WndTitle", script.WindowTitle);
grpParams.Properties.Add("WndMess", script.WindowMessage);
grpParams.Properties.Add("TmpDirSize", script.TemporaryDirectorySize.ToString());
grpParams.Properties.Add("TmpDirName", script.TemporaryDirectoryName);
grpParams.Properties.Add("CmdLine", script.CommandLine);
grpParams.Properties.Add("DrvWinClass", script.WindowClassName);
if (script.Require31Enabled)
foreach (BootstrapOperatingSystem item in script.OperatingSystems)
{
grpParams.Properties.Add("Require31", script.Require31Message);
}
plom.Groups.Add(grpParams);
string paramsGroupName = "Params";
string filesGroupName = "Files";
Group grpFiles = new Group("Files");
foreach (BootstrapFile file in script.Files)
{
grpFiles.Properties.Add(file.SourceFileName, file.DestinationFileName);
if (item != BootstrapOperatingSystem.PlatformIndependent)
{
paramsGroupName = item.Name + " Params";
filesGroupName = item.Name = " Files";
}
Group grpParams = new Group(paramsGroupName);
grpParams.Properties.Add("WndTitle", item.WindowTitle);
grpParams.Properties.Add("WndMess", item.WindowMessage);
grpParams.Properties.Add("TmpDirSize", item.TemporaryDirectorySize.ToString());
grpParams.Properties.Add("TmpDirName", item.TemporaryDirectoryName);
grpParams.Properties.Add("CmdLine", item.CommandLine);
grpParams.Properties.Add("DrvWinClass", item.WindowClassName);
if (item.Require31Enabled)
{
grpParams.Properties.Add("Require31", item.Require31Message);
}
plom.Groups.Add(grpParams);
Group grpFiles = new Group(filesGroupName);
foreach (BootstrapFile file in item.Files)
{
grpFiles.Properties.Add(file.SourceFileName, file.DestinationFileName);
}
plom.Groups.Add(grpFiles);
}
plom.Groups.Add(grpFiles);
objectModels.Push(plom);
}

View File

@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript
{
public class BootstrapOperatingSystem : ICloneable
{
public class BootstrapOperatingSystemCollection
: System.Collections.ObjectModel.Collection<BootstrapOperatingSystem>
{
public BootstrapOperatingSystem Add(string name)
{
BootstrapOperatingSystem item = new BootstrapOperatingSystem();
item.Name = name;
Add(item);
return item;
}
public BootstrapOperatingSystem AddOrRetrieve(string name)
{
if (Contains(name)) return this[name];
return Add(name);
}
public bool Contains(string name)
{
return (this[name] != null);
}
public BootstrapOperatingSystem this[string name]
{
get
{
foreach (BootstrapOperatingSystem item in this)
{
if (item.Name == name) return item;
}
return null;
}
}
}
private string mvarName = String.Empty;
public string Name { get { return mvarName; } set { mvarName = value; } }
private bool mvarEnabled = true;
public bool Enabled { get { return mvarEnabled; } set { mvarEnabled = value; } }
private string mvarWindowTitle = "Your Application Setup";
/// <summary>
/// The title of the setup initialization dialog.
/// </summary>
public string WindowTitle { get { return mvarWindowTitle; } set { mvarWindowTitle = value; } }
private string mvarWindowMessage = "Initializing Setup...";
/// <summary>
/// The message to display inside the setup initialization dialog.
/// </summary>
public string WindowMessage { get { return mvarWindowMessage; } set { mvarWindowMessage = value; } }
private int mvarTemporaryDirectorySize = 3200;
/// <summary>
/// The size of the directory in which to place the bootstrapped files.
/// </summary>
public int TemporaryDirectorySize { get { return mvarTemporaryDirectorySize; } set { mvarTemporaryDirectorySize = value; } }
private string mvarTemporaryDirectoryName = "~msstfqf.t";
/// <summary>
/// The name of the directory in which to place the bootstrapped files.
/// </summary>
public string TemporaryDirectoryName { get { return mvarTemporaryDirectoryName; } set { mvarTemporaryDirectoryName = value; } }
private string mvarCommandLine = String.Empty;
/// <summary>
/// The command to execute after bootstrapping, including any arguments.
/// </summary>
public string CommandLine { get { return mvarCommandLine; } set { mvarCommandLine = value; } }
private string mvarWindowClassName = "Stuff-Shell";
/// <summary>
/// The name of the window class to register for the setup initialization dialog.
/// </summary>
public string WindowClassName { get { return mvarWindowClassName; } set { mvarWindowClassName = value; } }
private string mvarRequire31Message = "This application requires a newer version of Microsoft Windows.";
/// <summary>
/// The message to display when a newer version of Microsoft Windows is required.
/// </summary>
public string Require31Message { get { return mvarRequire31Message; } set { mvarRequire31Message = value; } }
private bool mvarRequire31Enabled = false;
/// <summary>
/// Determines whether a newer version of Microsoft Windows is required.
/// </summary>
public bool Require31Enabled { get { return mvarRequire31Enabled; } set { mvarRequire31Enabled = value; } }
private BootstrapFile.BootstrapFileCollection mvarFiles = new BootstrapFile.BootstrapFileCollection();
public BootstrapFile.BootstrapFileCollection Files { get { return mvarFiles; } }
public object Clone()
{
BootstrapOperatingSystem clone = new BootstrapOperatingSystem();
clone.WindowTitle = (mvarWindowTitle.Clone() as string);
clone.WindowMessage = (mvarWindowMessage.Clone() as string);
clone.TemporaryDirectorySize = mvarTemporaryDirectorySize;
clone.TemporaryDirectoryName = (mvarTemporaryDirectoryName.Clone() as string);
clone.CommandLine = (mvarCommandLine.Clone() as string);
clone.WindowClassName = (mvarWindowClassName.Clone() as string);
clone.Require31Message = (mvarRequire31Message.Clone() as string);
clone.Require31Enabled = mvarRequire31Enabled;
foreach (BootstrapFile file in mvarFiles)
{
clone.Files.Add(file.Clone() as BootstrapFile);
}
return clone;
}
private static BootstrapOperatingSystem mvarPlatformIndependent = new BootstrapOperatingSystem();
/// <summary>
/// Gets the platform-independent <see cref="BootstrapOperatingSystem" /> definition.
/// </summary>
public static BootstrapOperatingSystem PlatformIndependent { get { return mvarPlatformIndependent; } }
public override string ToString()
{
return mvarName;
}
static BootstrapOperatingSystem()
{
mvarPlatformIndependent.Name = "(Platform-Independent)";
}
}
}

View File

@ -24,84 +24,20 @@ namespace UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript
return _omr;
}
private string mvarWindowTitle = "Your Application Setup";
/// <summary>
/// The title of the setup initialization dialog.
/// </summary>
public string WindowTitle { get { return mvarWindowTitle; } set { mvarWindowTitle = value; } }
private string mvarWindowMessage = "Initializing Setup...";
/// <summary>
/// The message to display inside the setup initialization dialog.
/// </summary>
public string WindowMessage { get { return mvarWindowMessage; } set { mvarWindowMessage = value; } }
private int mvarTemporaryDirectorySize = 3200;
/// <summary>
/// The size of the directory in which to place the bootstrapped files.
/// </summary>
public int TemporaryDirectorySize { get { return mvarTemporaryDirectorySize; } set { mvarTemporaryDirectorySize = value; } }
private string mvarTemporaryDirectoryName = "~msstfqf.t";
/// <summary>
/// The name of the directory in which to place the bootstrapped files.
/// </summary>
public string TemporaryDirectoryName { get { return mvarTemporaryDirectoryName; } set { mvarTemporaryDirectoryName = value; } }
private string mvarCommandLine = String.Empty;
/// <summary>
/// The command to execute after bootstrapping, including any arguments.
/// </summary>
public string CommandLine { get { return mvarCommandLine; } set { mvarCommandLine = value; } }
private string mvarWindowClassName = "Stuff-Shell";
/// <summary>
/// The name of the window class to register for the setup initialization dialog.
/// </summary>
public string WindowClassName { get { return mvarWindowClassName; } set { mvarWindowClassName = value; } }
private string mvarRequire31Message = "This application requires a newer version of Microsoft Windows.";
/// <summary>
/// The message to display when a newer version of Microsoft Windows is required.
/// </summary>
public string Require31Message { get { return mvarRequire31Message; } set { mvarRequire31Message = value; } }
private bool mvarRequire31Enabled = false;
/// <summary>
/// Determines whether a newer version of Microsoft Windows is required.
/// </summary>
public bool Require31Enabled { get { return mvarRequire31Enabled; } set { mvarRequire31Enabled = value; } }
private BootstrapFile.BootstrapFileCollection mvarFiles = new BootstrapFile.BootstrapFileCollection();
public BootstrapFile.BootstrapFileCollection Files { get { return mvarFiles; } }
private BootstrapOperatingSystem.BootstrapOperatingSystemCollection mvarOperatingSystems = new BootstrapOperatingSystem.BootstrapOperatingSystemCollection();
public BootstrapOperatingSystem.BootstrapOperatingSystemCollection OperatingSystems { get { return mvarOperatingSystems; } }
public override void Clear()
{
mvarWindowTitle = "Your Application Setup";
mvarWindowMessage = "Initializing Setup...";
mvarTemporaryDirectorySize = 3200;
mvarTemporaryDirectoryName = "~msstfqf.t";
mvarCommandLine = String.Empty;
mvarWindowClassName = "Stuff-Shell";
mvarRequire31Message = "This application requires a newer version of Microsoft Windows.";
mvarRequire31Enabled = false;
mvarFiles.Clear();
mvarOperatingSystems.Clear();
}
public override void CopyTo(ObjectModel where)
{
BootstrapScriptObjectModel clone = (where as BootstrapScriptObjectModel);
clone.WindowTitle = (mvarWindowTitle.Clone() as string);
clone.WindowMessage = (mvarWindowMessage.Clone() as string);
clone.TemporaryDirectorySize = mvarTemporaryDirectorySize;
clone.TemporaryDirectoryName = (mvarTemporaryDirectoryName.Clone() as string);
clone.CommandLine = (mvarCommandLine.Clone() as string);
clone.WindowClassName = (mvarWindowClassName.Clone() as string);
clone.Require31Message = (mvarRequire31Message.Clone() as string);
clone.Require31Enabled = mvarRequire31Enabled;
foreach (BootstrapFile file in mvarFiles)
foreach (BootstrapOperatingSystem item in mvarOperatingSystems)
{
clone.Files.Add(file.Clone() as BootstrapFile);
clone.OperatingSystems.Add(item.Clone() as BootstrapOperatingSystem);
}
}
}

View File

@ -37,6 +37,7 @@
<ItemGroup>
<Compile Include="DataFormats\Setup\Microsoft\ACME\BootstrapScript\LSTDataFormat.cs" />
<Compile Include="ObjectModels\Setup\Microsoft\ACME\BootstrapScript\BootstrapFile.cs" />
<Compile Include="ObjectModels\Setup\Microsoft\ACME\BootstrapScript\BootstrapOperatingSystem.cs" />
<Compile Include="ObjectModels\Setup\Microsoft\ACME\BootstrapScript\BootstrapScriptObjectModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>