From 24c3801f93475def3cba34b088c8cfc998fe8343 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Fri, 7 Aug 2020 02:32:25 -0400 Subject: [PATCH] add editor for Microsoft ACME setup bootstrapper LST file --- .../BootstrapScriptEditor.glade | 562 ++++++++++++++++++ .../BootstrapScriptEditor_Alternative.glade | 556 +++++++++++++++++ ...lEditor.Content.PlatformIndependent.csproj | 3 + .../Editors/BootstrapScriptEditor.cs | 408 +++++++++++++ .../Properties/AssemblyInfo.cs | 46 ++ ...lEditor.Plugins.Setup.UserInterface.csproj | 67 +++ .../ACME/BootstrapScript/LSTDataFormat.cs | 6 + .../BootstrapOperatingSystem.cs | 32 +- UniversalEditor.sln | 7 + 9 files changed, 1672 insertions(+), 15 deletions(-) create mode 100644 Content/UniversalEditor.Content.PlatformIndependent/Editors/Setup/BootstrapScript/BootstrapScriptEditor.glade create mode 100644 Content/UniversalEditor.Content.PlatformIndependent/Editors/Setup/BootstrapScript/BootstrapScriptEditor_Alternative.glade create mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/Editors/BootstrapScriptEditor.cs create mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/Properties/AssemblyInfo.cs create mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/UniversalEditor.Plugins.Setup.UserInterface.csproj diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Editors/Setup/BootstrapScript/BootstrapScriptEditor.glade b/Content/UniversalEditor.Content.PlatformIndependent/Editors/Setup/BootstrapScript/BootstrapScriptEditor.glade new file mode 100644 index 00000000..6d6d4a4c --- /dev/null +++ b/Content/UniversalEditor.Content.PlatformIndependent/Editors/Setup/BootstrapScript/BootstrapScriptEditor.glade @@ -0,0 +1,562 @@ + + + + + + False + + + + + + True + True + vertical + 200 + True + True + + + True + False + vertical + + + True + False + 0 + none + + + True + False + 12 + + + True + False + vertical + + + True + False + + + True + False + Add + _Add + True + gtk-add + + + False + True + + + + + True + False + Edit + _Edit + True + gtk-edit + + + False + True + + + + + True + False + _Remove + True + gtk-remove + + + False + True + + + + + True + False + + + False + True + + + + + True + False + Move Up + Move _Up + True + gtk-go-up + + + False + True + + + + + True + False + Move Down + Move _Down + True + gtk-go-down + + + False + True + + + + + False + True + 0 + + + + + True + True + in + + + True + True + tsPlatforms + 0 + + + + + + True + Name + True + True + 0 + + + + 0 + + + + + + + + + True + True + 1 + + + + + + + + + True + False + Platforms + + + + + True + True + 0 + + + + + True + False + + + + + True + False + vertical + + + True + True + + + True + False + vertical + + + True + False + + + True + False + Add + _Add + True + gtk-add + + + False + True + + + + + True + False + Edit + _Edit + True + gtk-edit + + + False + True + + + + + True + False + _Remove + True + gtk-remove + + + False + True + + + + + True + False + + + False + True + + + + + True + False + Move Up + Move _Up + True + gtk-go-up + + + False + True + + + + + True + False + Move Down + Move _Down + True + gtk-go-down + + + False + True + + + + + False + True + 0 + + + + + True + True + in + + + True + True + tsParameters + 0 + + + + + + True + Name + True + True + 0 + + + + 0 + + + + + + + True + Value + True + True + 1 + + + + 1 + + + + + + + + + True + True + 1 + + + + + + + True + False + Parameters + + + False + + + + + True + False + vertical + + + True + False + + + True + False + Add + _Add + True + gtk-add + + + False + True + + + + + True + False + Edit + _Edit + True + gtk-edit + + + False + True + + + + + True + False + _Remove + True + gtk-remove + + + False + True + + + + + True + False + + + False + True + + + + + True + False + Move Up + Move _Up + True + gtk-go-up + + + False + True + + + + + True + False + Move Down + Move _Down + True + gtk-go-down + + + False + True + + + + + False + True + 0 + + + + + True + True + in + + + True + True + tsFiles + 0 + + + + + + True + Source + True + True + 0 + + + + 0 + + + + + + + True + Destination + True + True + 1 + + + + 1 + + + + + + + + + True + True + 1 + + + + + 1 + + + + + True + False + Files + + + 1 + False + + + + + True + True + 0 + + + + + False + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Editors/Setup/BootstrapScript/BootstrapScriptEditor_Alternative.glade b/Content/UniversalEditor.Content.PlatformIndependent/Editors/Setup/BootstrapScript/BootstrapScriptEditor_Alternative.glade new file mode 100644 index 00000000..29e04567 --- /dev/null +++ b/Content/UniversalEditor.Content.PlatformIndependent/Editors/Setup/BootstrapScript/BootstrapScriptEditor_Alternative.glade @@ -0,0 +1,556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + + + + True + False + vertical + + + True + False + 0 + none + + + True + False + 12 + + + True + False + vertical + + + True + False + + + True + False + Add + _Add + True + gtk-add + + + False + True + + + + + True + False + Edit + _Edit + True + gtk-edit + + + False + True + + + + + True + False + _Remove + True + gtk-remove + + + False + True + + + + + True + False + + + False + True + + + + + True + False + Move Up + Move _Up + True + gtk-go-up + + + False + True + + + + + True + False + Move Down + Move _Down + True + gtk-go-down + + + False + True + + + + + False + True + 0 + + + + + True + True + in + + + True + True + tsPlatforms + 0 + + + + + + True + Name + True + True + 0 + + + + 0 + + + + + + + + + True + True + 1 + + + + + + + + + True + False + Platforms + + + + + True + True + 0 + + + + + True + False + 0 + none + + + True + False + 12 + + + True + False + vertical + + + True + False + + + True + False + Add + _Add + True + gtk-add + + + False + True + + + + + True + False + Edit + _Edit + True + gtk-edit + + + False + True + + + + + True + False + _Remove + True + gtk-remove + + + False + True + + + + + True + False + + + False + True + + + + + True + False + Move Up + Move _Up + True + gtk-go-up + + + False + True + + + + + True + False + Move Down + Move _Down + True + gtk-go-down + + + False + True + + + + + False + True + 0 + + + + + True + True + in + + + True + True + tsParameters + 0 + + + + + + True + Name + True + True + 0 + + + + 0 + + + + + + + True + Value + True + True + 1 + + + + 1 + + + + + + + + + True + True + 1 + + + + + + + + + True + False + Parameters + + + + + True + True + 1 + + + + + True + False + 0 + none + + + True + False + 12 + + + True + False + vertical + + + True + False + + + True + False + Add + _Add + True + gtk-add + + + False + True + + + + + True + False + Edit + _Edit + True + gtk-edit + + + False + True + + + + + True + False + _Remove + True + gtk-remove + + + False + True + + + + + True + False + + + False + True + + + + + True + False + Move Up + Move _Up + True + gtk-go-up + + + False + True + + + + + True + False + Move Down + Move _Down + True + gtk-go-down + + + False + True + + + + + False + True + 0 + + + + + True + True + in + + + True + True + tsFiles + 0 + + + + + + True + Source + True + True + 0 + + + + 0 + + + + + + + True + Destination + True + True + 1 + + + + 1 + + + + + + + + + True + True + 1 + + + + + + + + + True + False + Files + + + + + True + True + 2 + + + + + + diff --git a/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj b/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj index 9ac40dd6..f6c2fd17 100644 --- a/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj +++ b/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj @@ -749,6 +749,7 @@ + @@ -815,6 +816,8 @@ + + diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/Editors/BootstrapScriptEditor.cs b/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/Editors/BootstrapScriptEditor.cs new file mode 100644 index 00000000..518da54a --- /dev/null +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/Editors/BootstrapScriptEditor.cs @@ -0,0 +1,408 @@ +// +// BootstrapScriptEditor.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2020 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +using System.Collections.Generic; +using MBS.Framework.UserInterface; +using MBS.Framework.UserInterface.Controls; +using MBS.Framework.UserInterface.Dialogs; +using UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript; +using UniversalEditor.UserInterface; +using UniversalEditor.UserInterface.Dialogs; + +namespace UniversalEditor.Plugins.Setup.UserInterface +{ + [ContainerLayout("~/Editors/Setup/BootstrapScript/BootstrapScriptEditor.glade")] + public class BootstrapScriptEditor : Editor + { + private ListView tvPlatforms; + private ListView tvParameters; + private ListView tvFiles; + + private Toolbar tbPlatforms; + private Toolbar tbParameters; + private Toolbar tbFiles; + + private static EditorReference _er = null; + public override EditorReference MakeReference() + { + if (_er == null) + { + _er = base.MakeReference(); + _er.SupportedObjectModels.Add(typeof(BootstrapScriptObjectModel)); + } + return _er; + } + + [EventHandler(nameof(tvPlatforms), "SelectionChanged")] + private void tvPlatforms_SelectionChanged(object sender, EventArgs e) + { + if (tvPlatforms.SelectedRows.Count < 1) return; + + tvParameters.Model.Rows.Clear(); + tvFiles.Model.Rows.Clear(); + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + + foreach (KeyValuePair kvp in os.Parameters) + { + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] + { + new TreeModelRowColumn(tvParameters.Model.Columns[0], kvp.Key), + new TreeModelRowColumn(tvParameters.Model.Columns[1], kvp.Value) + }); + row.SetExtraData>("item", kvp); + tvParameters.Model.Rows.Add(row); + } + foreach (BootstrapFile file in os.Files) + { + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] + { + new TreeModelRowColumn(tvFiles.Model.Columns[0], file.SourceFileName), + new TreeModelRowColumn(tvFiles.Model.Columns[1], file.DestinationFileName) + }); + row.SetExtraData("item", file); + tvFiles.Model.Rows.Add(row); + } + } + + [EventHandler(nameof(tvPlatforms), "RowActivated")] + private void tvPlatforms_RowActivated(object sender, ListViewRowActivatedEventArgs e) + { + if (e.Row == null) return; + tsbPlatformEdit_Click(sender, e); + } + + private void tsbPlatformAdd_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + CustomOptionsDialog dlg = new CustomOptionsDialog(); + dlg.CustomOptions.Add(new CustomOptionText("Name", "Platform _name")); + if (dlg.ShowDialog() == DialogResult.OK) + { + string platformName = dlg.CustomOptions[0].GetValue()?.ToString(); + + BootstrapOperatingSystem os = new BootstrapOperatingSystem(); + os.Name = platformName; + + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] + { + new TreeModelRowColumn(tvPlatforms.Model.Columns[0], platformName) + }); + row.SetExtraData("item", os); + tvPlatforms.Model.Rows.Add(row); + + BeginEdit(); + setup.OperatingSystems.Add(os); + EndEdit(); + } + } + + private void tsbPlatformEdit_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + if (tvPlatforms.SelectedRows.Count < 1) return; + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + if (os == null) return; + + CustomOptionsDialog dlg = new CustomOptionsDialog(); + dlg.CustomOptions.Add(new CustomOptionText("Name", "Platform _name", os.Name)); + if (dlg.ShowDialog() == DialogResult.OK) + { + string platformName = dlg.CustomOptions[0].GetValue()?.ToString(); + + BeginEdit(); + os.Name = platformName; + EndEdit(); + + tvPlatforms.SelectedRows[0].RowColumns[0].Value = platformName; + } + } + + private void tsbPlatformRemove_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + if (tvPlatforms.SelectedRows.Count < 1) return; + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + if (os == null) return; + + if (MessageDialog.ShowDialog("Removing the selected platform will remove all associated parameters and files. Continue?", "Remove Platform", MessageDialogButtons.YesNo, MessageDialogIcon.Warning) != DialogResult.Yes) + return; + + BeginEdit(); + setup.OperatingSystems.Remove(os); + EndEdit(); + + tvPlatforms.Model.Rows.Remove(tvPlatforms.SelectedRows[0]); + } + + [EventHandler(nameof(tvParameters), "RowActivated")] + private void tvParameters_RowActivated(object sender, ListViewRowActivatedEventArgs e) + { + if (e.Row == null) return; + tsbParameterEdit_Click(sender, e); + } + + private void tsbParameterAdd_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + if (tvPlatforms.SelectedRows.Count < 1) return; + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + if (os == null) return; + + CustomOptionsDialog dlg = new CustomOptionsDialog(); + dlg.CustomOptions.Add(new CustomOptionText("Name", "Parameter _name")); + dlg.CustomOptions.Add(new CustomOptionText("Value", "_Value")); + if (dlg.ShowDialog() == DialogResult.OK) + { + string name = dlg.CustomOptions[0].GetValue()?.ToString(); + string value = dlg.CustomOptions[1].GetValue()?.ToString(); + + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] + { + new TreeModelRowColumn(tvParameters.Model.Columns[0], name), + new TreeModelRowColumn(tvParameters.Model.Columns[1], value) + }); + row.SetExtraData>("item", new KeyValuePair(name, value)); + tvParameters.Model.Rows.Add(row); + + BeginEdit(); + os.Parameters.Add(name, value); + EndEdit(); + } + } + + private void tsbParameterEdit_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + if (tvPlatforms.SelectedRows.Count < 1) return; + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + if (os == null) return; + + string oldname = tvParameters.SelectedRows[0].GetExtraData>("item").Key; + + CustomOptionsDialog dlg = new CustomOptionsDialog(); + dlg.CustomOptions.Add(new CustomOptionText("Name", "Parameter _name", oldname)); + dlg.CustomOptions.Add(new CustomOptionText("Value", "_Value", os.Parameters[oldname])); + if (dlg.ShowDialog() == DialogResult.OK) + { + string name = dlg.CustomOptions[0].GetValue()?.ToString(); + string value = dlg.CustomOptions[1].GetValue()?.ToString(); + + if (os.Parameters.ContainsKey(oldname)) + { + os.Parameters.Remove(oldname); + } + + BeginEdit(); + os.Parameters[name] = value; + EndEdit(); + + tvParameters.SelectedRows[0].RowColumns[0].Value = name; + tvParameters.SelectedRows[0].RowColumns[1].Value = value; + } + } + + private void tsbParameterRemove_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + if (tvPlatforms.SelectedRows.Count < 1) return; + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + if (os == null) return; + + string name = tvParameters.SelectedRows[0].GetExtraData>("item").Key; + + if (MessageDialog.ShowDialog(String.Format("Are you sure you want to remove the '{0}' parameter?", name), "Remove Parameter", MessageDialogButtons.YesNo, MessageDialogIcon.Warning) != DialogResult.Yes) + return; + + BeginEdit(); + os.Parameters.Remove(name); + EndEdit(); + + tvParameters.Model.Rows.Remove(tvParameters.SelectedRows[0]); + } + + [EventHandler(nameof(tvFiles), "RowActivated")] + private void tvFiles_RowActivated(object sender, ListViewRowActivatedEventArgs e) + { + if (e.Row == null) return; + tsbFileEdit_Click(sender, e); + } + + private void tsbFileAdd_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + if (tvPlatforms.SelectedRows.Count < 1) return; + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + if (os == null) return; + + CustomOptionsDialog dlg = new CustomOptionsDialog(); + dlg.CustomOptions.Add(new CustomOptionText("SourceFileName", "_Source")); + dlg.CustomOptions.Add(new CustomOptionText("DestinationFileName", "_Destination")); + if (dlg.ShowDialog() == DialogResult.OK) + { + string name = dlg.CustomOptions[0].GetValue()?.ToString(); + string value = dlg.CustomOptions[1].GetValue()?.ToString(); + + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] + { + new TreeModelRowColumn(tvFiles.Model.Columns[0], name), + new TreeModelRowColumn(tvFiles.Model.Columns[1], value) + }); + + BootstrapFile file = new BootstrapFile(); + file.SourceFileName = name; + file.DestinationFileName = value; + row.SetExtraData("item", file); + tvFiles.Model.Rows.Add(row); + + BeginEdit(); + os.Files.Add(file); + EndEdit(); + } + } + + private void tsbFileEdit_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + if (tvPlatforms.SelectedRows.Count < 1) return; + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + if (os == null) return; + + if (tvFiles.SelectedRows.Count < 1) return; + + BootstrapFile file = tvFiles.SelectedRows[0].GetExtraData("item"); + + CustomOptionsDialog dlg = new CustomOptionsDialog(); + dlg.CustomOptions.Add(new CustomOptionText("Name", "_Source", file.SourceFileName)); + dlg.CustomOptions.Add(new CustomOptionText("Value", "_Destination", file.DestinationFileName)); + if (dlg.ShowDialog() == DialogResult.OK) + { + string name = dlg.CustomOptions[0].GetValue()?.ToString(); + string value = dlg.CustomOptions[1].GetValue()?.ToString(); + + BeginEdit(); + file.SourceFileName = name; + file.DestinationFileName = value; + EndEdit(); + + tvFiles.SelectedRows[0].RowColumns[0].Value = name; + tvFiles.SelectedRows[0].RowColumns[1].Value = value; + } + } + + private void tsbFileRemove_Click(object sender, EventArgs e) + { + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + if (tvPlatforms.SelectedRows.Count < 1) return; + + BootstrapOperatingSystem os = tvPlatforms.SelectedRows[0].GetExtraData("item"); + if (os == null) return; + + BootstrapFile file = tvFiles.SelectedRows[0].GetExtraData("item"); + + if (MessageDialog.ShowDialog(String.Format("Are you sure you want to remove the '{0}' file?", file.SourceFileName), "Remove File", MessageDialogButtons.YesNo, MessageDialogIcon.Warning) != DialogResult.Yes) + return; + + BeginEdit(); + os.Files.Remove(file); + EndEdit(); + + tvFiles.Model.Rows.Remove(tvFiles.SelectedRows[0]); + } + + protected override void OnCreated(EventArgs e) + { + base.OnCreated(e); + + (tbPlatforms.Items["tsbPlatformAdd"] as ToolbarItemButton).Click += tsbPlatformAdd_Click; + (tbPlatforms.Items["tsbPlatformEdit"] as ToolbarItemButton).Click += tsbPlatformEdit_Click; + (tbPlatforms.Items["tsbPlatformRemove"] as ToolbarItemButton).Click += tsbPlatformRemove_Click; + + (tbParameters.Items["tsbParameterAdd"] as ToolbarItemButton).Click += tsbParameterAdd_Click; + (tbParameters.Items["tsbParameterEdit"] as ToolbarItemButton).Click += tsbParameterEdit_Click; + (tbParameters.Items["tsbParameterRemove"] as ToolbarItemButton).Click += tsbParameterRemove_Click; + + (tbFiles.Items["tsbFileAdd"] as ToolbarItemButton).Click += tsbFileAdd_Click; + (tbFiles.Items["tsbFileEdit"] as ToolbarItemButton).Click += tsbFileEdit_Click; + (tbFiles.Items["tsbFileRemove"] as ToolbarItemButton).Click += tsbFileRemove_Click; + + OnObjectModelChanged(e); + } + protected override void OnObjectModelChanged(EventArgs e) + { + base.OnObjectModelChanged(e); + + if (!IsCreated) return; + + tvPlatforms.Model.Rows.Clear(); + tvParameters.Model.Rows.Clear(); + tvFiles.Model.Rows.Clear(); + + BootstrapScriptObjectModel setup = (ObjectModel as BootstrapScriptObjectModel); + if (setup == null) return; + + foreach (BootstrapOperatingSystem os in setup.OperatingSystems) + { + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] + { + new TreeModelRowColumn(tvPlatforms.Model.Columns[0], os.Name) + }); + row.SetExtraData("item", os); + tvPlatforms.Model.Rows.Add(row); + } + } + + protected override EditorSelection CreateSelectionInternal(object content) + { + throw new NotImplementedException(); + } + public override void UpdateSelections() + { + throw new NotImplementedException(); + } + + } +} diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/Properties/AssemblyInfo.cs b/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0e42a5ca --- /dev/null +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/Properties/AssemblyInfo.cs @@ -0,0 +1,46 @@ +// +// AssemblyInfo.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2020 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("UniversalEditor.Plugins.Setup.UserInterface")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Mike Becker's Software")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Mike Becker's Software")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/UniversalEditor.Plugins.Setup.UserInterface.csproj b/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/UniversalEditor.Plugins.Setup.UserInterface.csproj new file mode 100644 index 00000000..ad104689 --- /dev/null +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Setup.UserInterface/UniversalEditor.Plugins.Setup.UserInterface.csproj @@ -0,0 +1,67 @@ + + + + Debug + AnyCPU + {047F47EF-2A68-45A6-9F81-4EB499D9FB06} + Library + UniversalEditor.Plugins.Setup.UserInterface + UniversalEditor.Plugins.Setup.UserInterface + v4.7 + 4.0.2019.12 + + + true + full + false + ..\..\Output\Debug\Plugins + DEBUG; + prompt + 4 + false + + + true + ..\..\Output\Release\Plugins + prompt + 4 + false + + + + + + + + + + + + + + {05127997-B7F3-4802-8021-06C048C8FE63} + UniversalEditor.Plugins.Microsoft.Setup + + + {00266B21-35C9-4A7F-A6BA-D54D7FDCC25C} + MBS.Framework + + + {29E1C1BB-3EA5-4062-B62F-85EEC703FE07} + MBS.Framework.UserInterface + + + {2D4737E6-6D95-408A-90DB-8DFF38147E85} + UniversalEditor.Core + + + {30467E5C-05BC-4856-AADC-13906EF4CADD} + UniversalEditor.Essential + + + {8622EBC4-8E20-476E-B284-33D472081F5C} + UniversalEditor.UserInterface + + + + \ No newline at end of file diff --git a/Plugins/UniversalEditor.Plugins.Microsoft.Setup/DataFormats/Setup/Microsoft/ACME/BootstrapScript/LSTDataFormat.cs b/Plugins/UniversalEditor.Plugins.Microsoft.Setup/DataFormats/Setup/Microsoft/ACME/BootstrapScript/LSTDataFormat.cs index ff3e1d0a..1991e174 100644 --- a/Plugins/UniversalEditor.Plugins.Microsoft.Setup/DataFormats/Setup/Microsoft/ACME/BootstrapScript/LSTDataFormat.cs +++ b/Plugins/UniversalEditor.Plugins.Microsoft.Setup/DataFormats/Setup/Microsoft/ACME/BootstrapScript/LSTDataFormat.cs @@ -60,7 +60,9 @@ namespace UniversalEditor.DataFormats.Setup.Microsoft.ACME.BootstrapScript base.AfterLoadInternal(objectModels); PropertyListObjectModel plom = (objectModels.Pop() as PropertyListObjectModel); + BootstrapScriptObjectModel script = (objectModels.Pop() as BootstrapScriptObjectModel); + if (script == null) throw new ObjectModelNotSupportedException(); foreach (Group grp in plom.Items.OfType()) { @@ -89,6 +91,10 @@ namespace UniversalEditor.DataFormats.Setup.Microsoft.ACME.BootstrapScript operatingSystem.Require31Enabled = true; operatingSystem.Require31Message = grp.GetPropertyValue("Require31"); } + if (grp.Items.Contains("DrvModName")) + { + operatingSystem.DriverModuleName = grp.GetPropertyValue("DrvModName"); + } } else if (grp.Name == "Files" || grp.Name.EndsWith(" Files")) { diff --git a/Plugins/UniversalEditor.Plugins.Microsoft.Setup/ObjectModels/Setup/Microsoft/ACME/BootstrapScript/BootstrapOperatingSystem.cs b/Plugins/UniversalEditor.Plugins.Microsoft.Setup/ObjectModels/Setup/Microsoft/ACME/BootstrapScript/BootstrapOperatingSystem.cs index 51e65298..2f9f3bf6 100644 --- a/Plugins/UniversalEditor.Plugins.Microsoft.Setup/ObjectModels/Setup/Microsoft/ACME/BootstrapScript/BootstrapOperatingSystem.cs +++ b/Plugins/UniversalEditor.Plugins.Microsoft.Setup/ObjectModels/Setup/Microsoft/ACME/BootstrapScript/BootstrapOperatingSystem.cs @@ -20,6 +20,7 @@ // along with this program. If not, see . using System; +using System.Collections.Generic; namespace UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript { @@ -73,43 +74,43 @@ namespace UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript /// /// The title of the setup initialization dialog. /// - public string WindowTitle { get { return mvarWindowTitle; } set { mvarWindowTitle = value; } } + public string WindowTitle { get { return Parameters.ContainsKey("WndTitle") ? Parameters["WndTitle"] : mvarWindowTitle; } set { mvarWindowTitle = value; Parameters["WndTitle"] = value; } } private string mvarWindowMessage = "Initializing Setup..."; /// /// The message to display inside the setup initialization dialog. /// - public string WindowMessage { get { return mvarWindowMessage; } set { mvarWindowMessage = value; } } + public string WindowMessage { get { return Parameters.ContainsKey("WndMess") ? Parameters["WndMess"] : mvarWindowMessage; } set { mvarWindowMessage = value; Parameters["WndMess"] = value; } } private int mvarTemporaryDirectorySize = 3200; /// /// The size of the directory in which to place the bootstrapped files. /// - public int TemporaryDirectorySize { get { return mvarTemporaryDirectorySize; } set { mvarTemporaryDirectorySize = value; } } + public int TemporaryDirectorySize { get { return Parameters.ContainsKey("TmpDirSize") ? Int32.Parse(Parameters["TmpDirSize"]) : mvarTemporaryDirectorySize; } set { mvarTemporaryDirectorySize = value; Parameters["TmpDirSize"] = value.ToString(); } } private string mvarTemporaryDirectoryName = "~msstfqf.t"; /// /// The name of the directory in which to place the bootstrapped files. /// - public string TemporaryDirectoryName { get { return mvarTemporaryDirectoryName; } set { mvarTemporaryDirectoryName = value; } } + public string TemporaryDirectoryName { get { return Parameters.ContainsKey("TmpDirName") ? Parameters["TmpDirName"] : mvarTemporaryDirectoryName; } set { mvarTemporaryDirectoryName = value; Parameters["TmpDirName"] = value; } } private string mvarCommandLine = String.Empty; /// /// The command to execute after bootstrapping, including any arguments. /// - public string CommandLine { get { return mvarCommandLine; } set { mvarCommandLine = value; } } + public string CommandLine { get { return Parameters.ContainsKey("CmdLine") ? Parameters["CmdLine"] : mvarCommandLine; } set { mvarCommandLine = value; Parameters["CmdLine"] = value; } } private string mvarWindowClassName = "Stuff-Shell"; /// /// The name of the window class to register for the setup initialization dialog. /// - public string WindowClassName { get { return mvarWindowClassName; } set { mvarWindowClassName = value; } } + public string WindowClassName { get { return Parameters.ContainsKey("DrvWinClass") ? Parameters["DrvWinClass"] : mvarWindowClassName; } set { mvarWindowClassName = value; Parameters["DrvWinClass"] = value; } } private string mvarRequire31Message = "This application requires a newer version of Microsoft Windows."; /// /// The message to display when a newer version of Microsoft Windows is required. /// - public string Require31Message { get { return mvarRequire31Message; } set { mvarRequire31Message = value; } } + public string Require31Message { get { return Parameters.ContainsKey("Require31") ? Parameters["Require31"] : mvarRequire31Message; } set { mvarRequire31Message = value; Parameters["Require31"] = value; } } private bool mvarRequire31Enabled = false; /// @@ -117,20 +118,19 @@ namespace UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript /// public bool Require31Enabled { get { return mvarRequire31Enabled; } set { mvarRequire31Enabled = value; } } + private string mvarDriverModuleName = null; + public string DriverModuleName { get { return Parameters.ContainsKey("DrvModName") ? Parameters["DrvModName"] : mvarDriverModuleName; } set { mvarDriverModuleName = value; Parameters["DrvModName"] = 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 (KeyValuePair kvp in Parameters) + { + clone.Parameters.Add(kvp.Key, kvp.Value); + } foreach (BootstrapFile file in mvarFiles) { clone.Files.Add(file.Clone() as BootstrapFile); @@ -144,6 +144,8 @@ namespace UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript /// public static BootstrapOperatingSystem PlatformIndependent { get { return mvarPlatformIndependent; } } + public Dictionary Parameters { get; } = new Dictionary(); + public override string ToString() { return mvarName; diff --git a/UniversalEditor.sln b/UniversalEditor.sln index a256a290..f832d596 100644 --- a/UniversalEditor.sln +++ b/UniversalEditor.sln @@ -177,6 +177,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Off EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Office.UserInterface", "Plugins.UserInterface\UniversalEditor.Plugins.Office.UserInterface\UniversalEditor.Plugins.Office.UserInterface.csproj", "{317CDFBC-9B41-4157-B2C0-D37E2BCEB42B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Setup.UserInterface", "Plugins.UserInterface\UniversalEditor.Plugins.Setup.UserInterface\UniversalEditor.Plugins.Setup.UserInterface.csproj", "{047F47EF-2A68-45A6-9F81-4EB499D9FB06}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -513,6 +515,10 @@ Global {317CDFBC-9B41-4157-B2C0-D37E2BCEB42B}.Debug|Any CPU.Build.0 = Debug|Any CPU {317CDFBC-9B41-4157-B2C0-D37E2BCEB42B}.Release|Any CPU.ActiveCfg = Release|Any CPU {317CDFBC-9B41-4157-B2C0-D37E2BCEB42B}.Release|Any CPU.Build.0 = Release|Any CPU + {047F47EF-2A68-45A6-9F81-4EB499D9FB06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {047F47EF-2A68-45A6-9F81-4EB499D9FB06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {047F47EF-2A68-45A6-9F81-4EB499D9FB06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {047F47EF-2A68-45A6-9F81-4EB499D9FB06}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {6F0AB1AF-E1A1-4D19-B19C-05BBB15C94B2} = {05D15661-E684-4EC9-8FBD-C014BA433CC5} @@ -596,6 +602,7 @@ Global {03B0D6C8-1C3C-4972-B102-3350FB628C5D} = {7B535D74-5496-4802-B809-89ED88274A91} {5D62192C-EB3E-4E73-A440-C53579B6EB47} = {2ED32D16-6C06-4450-909A-40D32DA67FB4} {317CDFBC-9B41-4157-B2C0-D37E2BCEB42B} = {7B535D74-5496-4802-B809-89ED88274A91} + {047F47EF-2A68-45A6-9F81-4EB499D9FB06} = {7B535D74-5496-4802-B809-89ED88274A91} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0