2024-08-05 18:02:01 -05:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Management.Automation ;
using System.Text ;
using System.Threading.Tasks ;
2025-10-06 19:23:49 -05:00
using LANCommander.SDK.Factories ;
2024-08-05 18:02:01 -05:00
using YamlDotNet.Serialization.NamingConventions ;
using YamlDotNet.Serialization ;
namespace LANCommander.SDK.PowerShell.Cmdlets
{
[Cmdlet(VerbsData.ConvertTo, "SerializedBase64")]
2026-05-08 02:02:33 -05:00
[OutputType(typeof(string))]
2026-01-24 16:37:07 -06:00
public class ConvertToSerializedBase64Cmdlet : Cmdlet
2024-08-05 18:02:01 -05:00
{
2026-05-08 02:02:33 -05:00
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The object to serialize to YAML and encode as a Base64 string.")]
2024-08-05 18:02:01 -05:00
public object Input { get ; set ; }
protected override void ProcessRecord ( )
{
2025-10-06 19:23:49 -05:00
var serializer = YamlSerializerFactory . Create ( ) ;
2024-08-05 18:02:01 -05:00
var output = Convert . ToBase64String ( Encoding . UTF8 . GetBytes ( serializer . Serialize ( Input ) ) ) ;
WriteObject ( output ) ;
}
}
}