Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Add a warning message to the registry license installation Cmdlet #64

Merged
merged 4 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/NServiceBus.PowerShell/Cmdlets/InstallPlatformLicense.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using RegistryView = Helpers.RegistryView;

[Cmdlet(VerbsLifecycle.Install, "NServiceBusPlatformLicense", DefaultParameterSetName = "ByLicenseFile")]
[Obsolete(@"Installing license information in the registry has been deprecated as the Particular Platform reads license info from file system. For legacy installations this cmdlet can still be used. See https://docs.particular.net/search?q=license.")]
public class InstallPlatformLicense : CmdletBase
{
[Parameter(Mandatory = true, HelpMessage = "Platform license file to import", Position = 0, ParameterSetName = "ByLicenseFile")]
Expand All @@ -19,6 +20,11 @@ public class InstallPlatformLicense : CmdletBase
[ValidateNotNullOrEmpty]
public string LicenseString { get; set; }

protected override void BeginProcessing()
{
WriteWarning("Installing license information in the registry has been deprecated as the Particular Platform reads license info from file system. For legacy installations this cmdlet can still be used. See https://docs.particular.net/search?q=license.");
}

protected override void ProcessRecord()
{
const string particular = @"Software\ParticularSoftware";
Expand Down
6 changes: 2 additions & 4 deletions src/NServiceBus.PowerShell/Helpers/RegistryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ public object ReadValue(string subKeyName, string valueName, object defaultValue
var cur = 0;
var len = blob.Length;

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
while (ret == 0 && cur < len)
while (cur < len)
{
var nextNull = cur;
while (nextNull < len && blob[nextNull] != (char) 0)
Expand All @@ -350,7 +349,6 @@ public object ReadValue(string subKeyName, string valueName, object defaultValue
}
cur = nextNull + 1;
}
// ReSharper enable once ConditionIsAlwaysTrueOrFalse

data = new String[strings.Count];
strings.CopyTo((String[]) data, 0);
Expand Down Expand Up @@ -589,4 +587,4 @@ public RegistryValueKind GetRegistryValueKind(string subKeyName, string valueNam
}
}
}
}
}
Loading