diff --git a/LANCommander.PowerShell/Cmdlets/ConvertFrom-SerializedBase64.cs b/LANCommander.PowerShell/Cmdlets/ConvertFrom-SerializedBase64.cs index 055aeee..d600b38 100644 --- a/LANCommander.PowerShell/Cmdlets/ConvertFrom-SerializedBase64.cs +++ b/LANCommander.PowerShell/Cmdlets/ConvertFrom-SerializedBase64.cs @@ -9,7 +9,7 @@ namespace LANCommander.PowerShell.Cmdlets { [Cmdlet(VerbsData.ConvertFrom, "SerializedBase64")] [OutputType(typeof(object))] - public class ConvertFromSerializedBase64Cmdlet : PSCmdlet + public class ConvertFromSerializedBase64Cmdlet : Cmdlet { [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] public string Input { get; set; } diff --git a/LANCommander.PowerShell/Cmdlets/ConvertTo-SerializedBase64.cs b/LANCommander.PowerShell/Cmdlets/ConvertTo-SerializedBase64.cs new file mode 100644 index 0000000..fe92654 --- /dev/null +++ b/LANCommander.PowerShell/Cmdlets/ConvertTo-SerializedBase64.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace LANCommander.PowerShell.Cmdlets +{ + [Cmdlet(VerbsData.ConvertTo, "SerializedBase64")] + [OutputType(typeof(object))] + public class ConvertToSerializedBase64Cmdlet : Cmdlet + { + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + public object Input { get; set; } + + protected override void ProcessRecord() + { + var output = Convert.ToBase64String(Encoding.UTF8.GetBytes(PSSerializer.Serialize(Input))); + + WriteObject(output); + } + } +} diff --git a/LANCommander.PowerShell/LANCommander.PowerShell.csproj b/LANCommander.PowerShell/LANCommander.PowerShell.csproj index 2357de7..b59a2f6 100644 --- a/LANCommander.PowerShell/LANCommander.PowerShell.csproj +++ b/LANCommander.PowerShell/LANCommander.PowerShell.csproj @@ -46,6 +46,7 @@ +