Improvements on IAP setup plugin

This commit is contained in:
Michael Becker 2015-04-17 22:10:03 -04:00
parent d4188749e1
commit 9d8b8bcf95
6 changed files with 131 additions and 6 deletions

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<UniversalEditor Version="4.0">
<Associations>
<Association>
<!-- Associate the Chunked ObjectModel with the UXT DataFormats and the FileSystem Editor -->
<Filters>
<Filter Title="Rebel Software Installation Script">
<FileNameFilters>
<FileNameFilter>*.iap</FileNameFilter>
</FileNameFilters>
</Filter>
</Filters>
<ObjectModels>
<ObjectModel TypeName="UniversalEditor.ObjectModels.RebelSoftware.InstallationScript.InstallationScriptObjectModel" />
</ObjectModels>
<DataFormats>
<DataFormat TypeName="UniversalEditor.DataFormats.RebelSoftware.InstallationScript.IAPDataFormat" />
</DataFormats>
</Association>
</Associations>
</UniversalEditor>

View File

@ -41,6 +41,7 @@
<Content Include="Associations\Markup.xml" />
<Content Include="Associations\DataLink.xml" />
<Content Include="Associations\PropertyList.xml" />
<Content Include="Associations\RebelSoftware\InstallationScript.xml" />
<Content Include="Associations\SecurityCertificate.xml" />
<Content Include="Associations\Shortcut.xml" />
<Content Include="Branding\MainIcon.ico" />

View File

@ -46,7 +46,23 @@ namespace UniversalEditor.Editors.RebelSoftware.InstallationScript
foreach (ISDialog dialog in script.Dialogs)
{
TreeNode tn = new TreeNode();
if (dialog is WelcomeDialog)
if (dialog is CopyFilesDialog)
{
tn.Text = "CopyFiles";
}
else if (dialog is FinishDialog)
{
tn.Text = "Finish";
}
else if (dialog is LicenseDialog)
{
tn.Text = "License";
}
else if (dialog is StartCopyingDialog)
{
tn.Text = "StartCopying";
}
else if (dialog is WelcomeDialog)
{
tn.Text = "Welcome";
}

View File

@ -31,6 +31,10 @@ namespace UniversalEditor.DataFormats.PropertyList.ExtensibleConfiguration
bool insideQuotedString = false;
bool escaping = false;
Group nextGroup = null;
// true if a real char (non-whitespace) was found; false otherwise
bool foundRealChar = false;
while (!tr.EndOfStream)
{
if (nextString.StartsWith(mvarSettings.SingleLineCommentStart))
@ -46,6 +50,18 @@ namespace UniversalEditor.DataFormats.PropertyList.ExtensibleConfiguration
}
char nextChar = tr.ReadChar();
if (!foundRealChar)
{
if (!Char.IsWhiteSpace(nextChar))
{
foundRealChar = true;
}
else
{
continue;
}
}
if (insideQuotedString)
{
if (nextChar == '"')
@ -79,10 +95,11 @@ namespace UniversalEditor.DataFormats.PropertyList.ExtensibleConfiguration
insideQuotedString = !insideQuotedString;
continue;
}
else if (cw == mvarSettings.PropertyNameValueSeparator)
else if (cw == mvarSettings.PropertyNameValueSeparator && (mvarSettings.AllowTopLevelProperties || nextGroup != null))
{
nextPropertyName = nextString;
nextString = string.Empty;
foundRealChar = false;
}
else if (cw == mvarSettings.PropertySeparator)
{
@ -102,6 +119,7 @@ namespace UniversalEditor.DataFormats.PropertyList.ExtensibleConfiguration
}
nextPropertyName = string.Empty;
nextString = string.Empty;
foundRealChar = false;
}
else if (cw == mvarSettings.GroupStart)
{

View File

@ -46,5 +46,10 @@ namespace UniversalEditor.DataFormats.PropertyList.ExtensibleConfiguration
/// </summary>
public bool InlineGroupStart { get { return mvarInlineGroupStart; } set { mvarInlineGroupStart = value; } }
private bool mvarAllowTopLevelProperties = true;
/// <summary>
/// Determines whether top-level properties (i.e., those outside of a group definition) are allowed.
/// </summary>
public bool AllowTopLevelProperties { get { return mvarAllowTopLevelProperties; } set { mvarAllowTopLevelProperties = value; } }
}
}

View File

@ -11,8 +11,19 @@ using UniversalEditor.ObjectModels.RebelSoftware.InstallationScript.Actions;
namespace UniversalEditor.DataFormats.RebelSoftware.InstallationScript
{
public class IAPDataFormat : ExtensibleConfigurationDataFormat
{
public class IAPDataFormat : ExtensibleConfigurationDataFormat
{
private DataFormatReference _dfr = null;
protected override DataFormatReference MakeReferenceInternal()
{
if (_dfr == null)
{
_dfr = new DataFormatReference(GetType());
_dfr.Capabilities.Add(typeof(InstallationScriptObjectModel), DataFormatCapabilities.All);
}
return _dfr;
}
public IAPDataFormat()
{
// quote characters are literally part of the property value
@ -24,15 +35,68 @@ namespace UniversalEditor.DataFormats.RebelSoftware.InstallationScript
// No separator except space between name and value
this.Settings.PropertyNameValueSeparator = " ";
// Property separator is the newline character
this.Settings.PropertySeparator = "\r\n";
// Do not allow top-level properties as property name/value separator (' ') conflicts with group definitions with spaces in them
this.Settings.AllowTopLevelProperties = false;
}
protected override void BeforeLoadInternal(Stack<ObjectModel> objectModels)
{
base.BeforeLoadInternal(objectModels);
objectModels.Push(new PropertyListObjectModel());
}
protected override void AfterLoadInternal(Stack<ObjectModel> objectModels)
{
base.AfterLoadInternal(objectModels);
PropertyListObjectModel plom = (objectModels.Pop() as PropertyListObjectModel);
InstallationScriptObjectModel script = (objectModels.Pop() as InstallationScriptObjectModel);
foreach (Group group in plom.Groups)
{
switch (group.Name)
{
case "IA_Globals":
{
break;
}
case "IA_WelcomeDialog":
{
script.Dialogs.Add(new WelcomeDialog());
break;
}
case "IA_FinishDialog":
{
script.Dialogs.Add(new FinishDialog());
break;
}
case "IA_LicenseDialog":
{
script.Dialogs.Add(new LicenseDialog());
break;
}
case "IA_DestinationDialog":
{
script.Dialogs.Add(new DestinationDialog());
break;
}
case "IA_StartCopyingDialog":
{
script.Dialogs.Add(new StartCopyingDialog());
break;
}
case "IA_CopyFilesDialog":
{
script.Dialogs.Add(new CopyFilesDialog());
break;
}
case "IA_StartMenu":
{
break;
}
}
}
}
protected override void BeforeSaveInternal(Stack<ObjectModel> objectModels)
{
@ -121,5 +185,5 @@ namespace UniversalEditor.DataFormats.RebelSoftware.InstallationScript
objectModels.Push(plom);
}
}
}
}