Skip to content

Commit

Permalink
fix(installer): add experimental tag to PEDM and session features (#1211
Browse files Browse the repository at this point in the history
)
  • Loading branch information
thenextman authored Feb 5, 2025
1 parent 6045c60 commit 29b2fac
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 25 deletions.
20 changes: 10 additions & 10 deletions package/AgentWindowsManaged/Actions/AgentActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,70 +229,70 @@ internal static class AgentActions
)
{
Id = new Id("installPedm"),
Feature = Includes.PEDM_FEATURE,
Feature = Features.PEDM_FEATURE,
Sequence = Sequence.InstallExecuteSequence,
Return = Return.check,
Step = Step.InstallFiles,
When = When.After,
Condition = Includes.PEDM_FEATURE.BeingInstall(),
Condition = Features.PEDM_FEATURE.BeingInstall(),
};

private static readonly ElevatedManagedAction cleanupPedmShellExt = new(
CustomActions.UninstallMsix
)
{
Id = new Id("cleanupPedmShellExt"),
Feature = Includes.PEDM_FEATURE,
Feature = Features.PEDM_FEATURE,
Impersonate = false,
Execute = Execute.deferred,
Return = Return.check,
Step = Step.RemoveFiles,
When = When.Before,
Sequence = Sequence.InstallExecuteSequence,
Condition = Includes.PEDM_FEATURE.BeingUninstall(),
Condition = Features.PEDM_FEATURE.BeingUninstall(),
};

private static readonly ElevatedManagedAction installPedmShellExt = new(
CustomActions.InstallMsix
)
{
Id = new Id("installPedmShellExt"),
Feature = Includes.PEDM_FEATURE,
Feature = Features.PEDM_FEATURE,
Impersonate = true,
Execute = Execute.deferred,
Return = Return.check,
Step = Step.InstallFiles,
When = When.After,
Sequence = Sequence.InstallExecuteSequence,
Condition = Includes.PEDM_FEATURE.BeingInstall(),
Condition = Features.PEDM_FEATURE.BeingInstall(),
};

private static readonly ElevatedManagedAction uninstallPedmShellExt = new(
CustomActions.UninstallMsix
)
{
Id = new Id("uninstallPedmShellExt"),
Feature = Includes.PEDM_FEATURE,
Feature = Features.PEDM_FEATURE,
Impersonate = false,
Execute = Execute.deferred,
Return = Return.check,
Step = Step.RemoveFiles,
When = When.Before,
Sequence = Sequence.InstallExecuteSequence,
Condition = Includes.PEDM_FEATURE.BeingUninstall(),
Condition = Features.PEDM_FEATURE.BeingUninstall(),
};

private static readonly ElevatedManagedAction installSession = new(
CustomActions.InstallSession
)
{
Id = new Id("installSession"),
Feature = Includes.SESSION_FEATURE,
Feature = Features.SESSION_FEATURE,
Sequence = Sequence.InstallExecuteSequence,
Return = Return.check,
Step = Step.InstallFiles,
When = When.After,
Condition = Includes.SESSION_FEATURE.BeingInstall(),
Condition = Features.SESSION_FEATURE.BeingInstall(),
};

private static string UseProperties(IEnumerable<IWixProperty> properties)
Expand Down
24 changes: 21 additions & 3 deletions package/AgentWindowsManaged/Dialogs/FeaturesDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using DevolutionsAgent.Resources;
using WixSharp;
using WixSharp.UI.Forms;
using View = System.Windows.Forms.View;

namespace DevolutionsAgent.Dialogs;

Expand All @@ -15,8 +17,15 @@ public partial class FeaturesDialog : AgentDialog
public FeaturesDialog()
{
InitializeComponent();
label1.MakeTransparentOn(banner);
label2.MakeTransparentOn(banner);

this.label1.MakeTransparentOn(banner);
this.label2.MakeTransparentOn(banner);

this.featuresTree.Columns.Clear();
this.featuresTree.Columns.Add(string.Empty, -1, HorizontalAlignment.Left);
this.featuresTree.Columns.Add(string.Empty, -1, HorizontalAlignment.Left);
this.featuresTree.View = View.Details;
this.featuresTree.HeaderStyle = ColumnHeaderStyle.None;
}

private void FeaturesDialog_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -65,12 +74,21 @@ private void BuildFeaturesHierarchy()
{
view.Checked = true;
}

if (Features.ExperimentalFeatures.Any(x => x.Id == rootItem.Name))
{
view.UseItemStyleForSubItems = false;
view.SubItems.Add(I18n(Strings.ExperimentalLabel));
view.SubItems[1].BackColor = Color.Yellow;
}
}

rootItems.Where(x => x.Display != FeatureDisplay.hidden)
.Select(x => x.View)
.Cast<ListViewItem>()
.ForEach(node => featuresTree.Items.Add(node));
.ForEach(featuresTree.Items.Add);

this.featuresTree.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
}

private void Reset_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
Expand Down
12 changes: 6 additions & 6 deletions package/AgentWindowsManaged/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static void Main()
project.CandleOptions = "-fips";
}

project.DefaultFeature = Includes.AGENT_FEATURE;
project.DefaultFeature = Features.AGENT_FEATURE;
project.Dirs = new Dir[]
{
new ("%ProgramFiles%", new Dir(Includes.VENDOR_NAME, new InstallDir(Includes.SHORT_NAME)
Expand Down Expand Up @@ -253,13 +253,13 @@ static void Main()
StopOn = SvcEvent.InstallUninstall,
},
},
new (Includes.PEDM_FEATURE, DevolutionsPedmShellExtDll),
new (Includes.PEDM_FEATURE, DevolutionsPedmShellExtMsix),
new (Includes.SESSION_FEATURE, DevolutionsSession)
new (Features.PEDM_FEATURE, DevolutionsPedmShellExtDll),
new (Features.PEDM_FEATURE, DevolutionsPedmShellExtMsix),
new (Features.SESSION_FEATURE, DevolutionsSession)
},
Dirs = new[]
{
new Dir(Includes.PEDM_FEATURE, "desktop", new Files(Includes.PEDM_FEATURE, $"{DevolutionsDesktopAgentPath}\\*.*"))
new Dir(Features.PEDM_FEATURE, "desktop", new Files(Features.PEDM_FEATURE, $"{DevolutionsDesktopAgentPath}\\*.*"))
}
})),
};
Expand All @@ -280,7 +280,7 @@ static void Main()
{
Win64 = project.Platform == Platform.x64,
RegistryKeyAction = RegistryKeyAction.create,
Feature = Includes.PEDM_FEATURE,
Feature = Features.PEDM_FEATURE,
}
};
project.Properties = AgentProperties.Properties.Select(x => x.ToWixSharpProperty()).ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<!-- properties -->
<String Id="Property_Directory">Directory</String>
<!-- static -->
<String Id="ExperimentalLabel">Experimental</String>
<String Id="UACPromptLabel">Please wait for UAC prompt to appear.

If it appears minimized then active it from the taskbar.</String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- properties -->
<String Id="Property_Directory">Répertoire</String>
<!-- static -->
<String Id="ExperimentalLabel">Expérimental</String>
<String Id="UACPromptLabel">Veuillez attendre que l'invite UAC apparaisse.

Si elle apparaît en mode réduit, alors vous devez l'activer à partir de la barre de tâches.</String>
Expand Down
26 changes: 26 additions & 0 deletions package/AgentWindowsManaged/Resources/Features.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Collections.Generic;
using WixSharp;

namespace DevolutionsAgent.Resources
{
internal static class Features
{
internal static IEnumerable<Feature> ExperimentalFeatures => [ PEDM_FEATURE, SESSION_FEATURE ];

internal static Feature AGENT_FEATURE = new("!(loc.FeatureAgentName)", true, false)
{
Id = "F.Agent",
Description = "!(loc.FeatureAgentDescription)"
};

internal static Feature PEDM_FEATURE = new("!(loc.FeaturePedmName)", "!(loc.FeaturePedmDescription)", false)
{
Id = "F.Pedm"
};

internal static Feature SESSION_FEATURE = new("!(loc.FeatureSessionName)", "!(loc.FeatureSessionDescription)", false)
{
Id = "F.Session"
};
}
}
6 changes: 0 additions & 6 deletions package/AgentWindowsManaged/Resources/Includes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ internal static class Includes

internal static string INFO_URL = "https://server.devolutions.net";

internal static Feature AGENT_FEATURE = new("!(loc.FeatureAgentName)", true, false) { Id = "F.Agent", Description = "!(loc.FeatureAgentDescription)" };

internal static Feature PEDM_FEATURE = new("!(loc.FeaturePedmName)", "!(loc.FeaturePedmDescription)", false) { Id = "F.Pedm" };

internal static Feature SESSION_FEATURE = new("!(loc.FeatureSessionName)", "!(loc.FeatureSessionDescription)", false) { Id = "F.Session" };

/// <summary>
/// SDDL string representing desired %programdata%\devolutions\agent ACL
/// Easiest way to generate an SDDL is to configure the required access, and then query the path with PowerShell: `Get-Acl | Format-List`
Expand Down
4 changes: 4 additions & 0 deletions package/AgentWindowsManaged/Resources/Strings.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public static string I18n(this MsiRuntime runtime, string res)
/// </summary>
public const string UACPromptLabel = "UACPromptLabel";
/// <summary>
/// Experimental
/// </summary>
public const string ExperimentalLabel = "ExperimentalLabel";
/// <summary>
/// All Files
/// </summary>
public const string Filter_AllFiles = "Filter_AllFiles";
Expand Down
4 changes: 4 additions & 0 deletions package/AgentWindowsManaged/Resources/Strings_en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
{
"id": "UACPromptLabel",
"text": "Please wait for UAC prompt to appear.\n\nIf it appears minimized then active it from the taskbar."
},
{
"id": "ExperimentalLabel",
"text": "Experimental"
}
],
"filters": [
Expand Down
4 changes: 4 additions & 0 deletions package/AgentWindowsManaged/Resources/Strings_fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
{
"id": "UACPromptLabel",
"text": "Veuillez attendre que l'invite UAC apparaisse.\n\nSi elle apparaît en mode réduit, alors vous devez l'activer à partir de la barre de tâches."
},
{
"id": "ExperimentalLabel",
"text": "Expérimental"
}
],
"filters": [
Expand Down

0 comments on commit 29b2fac

Please sign in to comment.