Add cmdlet for encoding serialized objects for PS
parent
ed1b4973d3
commit
8abc2fa15e
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,6 +46,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Cmdlets\ConvertTo-SerializedBase64.cs" />
|
||||
<Compile Include="Cmdlets\ConvertFrom-SerializedBase64.cs" />
|
||||
<Compile Include="Cmdlets\Edit-PatchBinary.cs" />
|
||||
<Compile Include="Cmdlets\Uninstall-Game.cs" />
|
||||
|
|
Loading…
Reference in New Issue