Skip to content

Commit

Permalink
wip: update msix designer to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Painter, Christopher P authored and Painter, Christopher P committed Dec 20, 2023
1 parent fb3ee84 commit 178da23
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 12 deletions.
33 changes: 28 additions & 5 deletions Application/Designers/MSIXDesigner/MSIXs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
using FireworksFramework.Managers;
using IsWiXAutomationInterface;
using static FireworksFramework.Types.Enums;
using System.Security.Policy;
using System.Windows.Input;
using System.Xml.Linq;

namespace MSIXDesigner
{
Expand Down Expand Up @@ -60,12 +63,12 @@ public bool SuppressFireGiantMessage
public bool IsValidContext()
{
DocumentManager documentManager = DocumentManager.DocumentManagerInstance;
return (documentManager.Document.GetWiXVersion() == WiXVersion.v3 && documentManager.Document.GetDocumentType() == IsWiXDocumentType.Product);
return (documentManager.Document.GetDocumentType() == IsWiXDocumentType.Product);
}

public void LoadData()
{
if (_fgWiXInstalled)
if (_fgWiXInstalled || DocumentManager.DocumentManagerInstance.Document.GetWiXVersion() == WiXVersion.v4)
{
linkLabelRequirements.Visible = false;
LoadDocument();
Expand Down Expand Up @@ -109,10 +112,13 @@ private void AddMSIXNode(IsWiXFGMSIX isWiXFGMSIX)

private void UpdatedSelectedNodeText()
{
IsWiXFGMSIX msix = treeViewMSIXs.SelectedNode.Tag as IsWiXFGMSIX;
if (msix != null)
if (treeViewMSIXs.SelectedNode != null)
{
treeViewMSIXs.SelectedNode.Text = msix.Id;
IsWiXFGMSIX msix = treeViewMSIXs.SelectedNode.Tag as IsWiXFGMSIX;
if (msix != null)
{
treeViewMSIXs.SelectedNode.Text = msix.Id;
}
}
}

Expand Down Expand Up @@ -157,6 +163,7 @@ private void linkLabelRequirements_LinkClicked(object sender, LinkLabelLinkClick

private void treeViewMSIXs_AfterSelect(object sender, TreeViewEventArgs e)
{
msix1 = new MSIX();
propertyGrid1.Enabled = true;
propertyGrid1.SelectedObject = msix1;
msix1.Read(e.Node.Tag as IsWiXFGMSIX);
Expand All @@ -170,6 +177,22 @@ private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEv

private void toolStripMenuItemNewFeature_Click(object sender, EventArgs e)
{
string ns = null;
if (_documentManager.Document.GetWiXVersion() == WiXVersion.v3)
{
ns = "http://www.firegiant.com/schemas/v3/wxs/fgappx.xsd";
}
else
{
ns = "http://www.firegiant.com/schemas/v4/wxs/heatwave/buildtools/msix";
}

if(!_documentManager.Document.NameSpaces().ContainsKey("msix"))
{
_documentManager.Document.Root.Add(new XAttribute(XNamespace.Xmlns + "msix", ns));
_documentManager.RefreshNamespaces();
}

IsWiXFGMSIXs msixs = new IsWiXFGMSIXs(_documentManager.Document);
string msixName = IsWiXFGMSIXs.SuggestNextMSIXName(_documentManager.Document);
IsWiXFGMSIX msix = msixs.Create(msixName, "CN=, O=, STREET=, L=, S=, PostalCode=, C=", TargetType.desktop);
Expand Down
64 changes: 62 additions & 2 deletions Application/Designers/MSIXDesigner/MSIXs.resx
Original file line number Diff line number Diff line change
@@ -1,4 +1,64 @@
<root>
<?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">
Expand Down Expand Up @@ -68,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAohMAAAJNU0Z0AUkBTAIBAQwB
AAFsAQIBbAECARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMAAUADAAFAAwABAQEAAQgG
AAF8AQIBfAECARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMAAUADAAFAAwABAQEAAQgG
AAEQGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEAAfABygGmAQABMwUAATMB
AAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEAAYABfAH/AQACUAH/AQAB
kwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFmAwABmQMAAcwCAAEzAwAC
Expand Down
33 changes: 30 additions & 3 deletions Application/Shared/IsWiXAutomationInterface/IsWiXFGMSIX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Xml.Linq;
using Microsoft.Win32;
using FireworksFramework.Managers;
using System.Reflection.Metadata;

namespace IsWiXAutomationInterface
{
Expand All @@ -16,7 +17,15 @@ public class IsWiXFGMSIXs : List<IsWiXFGMSIX>
public IsWiXFGMSIXs(XDocument Document)
{
_document = Document;
ns = "http://www.firegiant.com/schemas/v3/wxs/fgmsix.xsd";
_document = Document;
if (_document.GetWiXVersion() == WiXVersion.v3)
{
ns = "http://www.firegiant.com/schemas/v3/wxs/fgappx.xsd";
}
else
{
ns = "http://www.firegiant.com/schemas/v4/wxs/heatwave/buildtools/msix";
}
Load();
}

Expand Down Expand Up @@ -85,7 +94,16 @@ public IsWiXFGMSIX Create(string id, string publisher, TargetType targetType)

public static string SuggestNextMSIXName(XDocument document)
{
XNamespace ns = "http://www.firegiant.com/schemas/v3/wxs/fgmsix.xsd";
XNamespace ns;
if (document.GetWiXVersion() == WiXVersion.v3)
{
ns = "http://www.firegiant.com/schemas/v3/wxs/fgappx.xsd";
}
else
{
ns = "http://www.firegiant.com/schemas/v4/wxs/heatwave/buildtools/msix";
}

int i = 1;
string suggestedMSIXName;
bool found = false;
Expand Down Expand Up @@ -125,13 +143,22 @@ public void SortXML()

public class IsWiXFGMSIX
{
XNamespace ns = "http://www.firegiant.com/schemas/v3/wxs/fgmsix.xsd";
XNamespace ns;
XElement _msixElement;
XDocument _document;

public IsWiXFGMSIX(XDocument document, XElement msixElement)
{
_document = document;
if (_document.GetWiXVersion() == WiXVersion.v3)
{
ns = "http://www.firegiant.com/schemas/v3/wxs/fgappx.xsd";
}
else
{
ns = "http://www.firegiant.com/schemas/v4/wxs/heatwave/buildtools/msix";
}

_msixElement = msixElement;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public void Load()
_documentManager.RefreshNamespaces();
}

public Dictionary<string, string> PossibleNamespaces
public SortedDictionary<string, string> PossibleNamespaces
{
get
{

var _extensions = new Dictionary<string, string>();
var _extensions = new SortedDictionary<string, string>();

try
{
Expand Down

0 comments on commit 178da23

Please sign in to comment.