wabbajack/Wabbajack.CLI/Verbs/Encrypt.cs

25 lines
829 B
C#
Raw Normal View History

using System.Threading.Tasks;
using Alphaleonis.Win32.Filesystem;
2020-01-31 22:38:56 +00:00
using CommandLine;
using Wabbajack.Common;
namespace Wabbajack.CLI.Verbs
{
[Verb("encrypt", HelpText = @"Encrypt local data and store it in AppData\Local\Wabbajack", Hidden = true)]
public class Encrypt : AVerb
2020-01-31 22:38:56 +00:00
{
[Option('n', "name", Required = true, HelpText = @"Credential to encrypt and store in AppData\Local\Wabbajack")]
2020-04-06 12:04:40 +00:00
public string? Name { get; set; }
2020-01-31 22:38:56 +00:00
[IsFile(CustomMessage = "The input file %1 does not exist!")]
2020-01-31 22:38:56 +00:00
[Option('i', "input", Required = true, HelpText = @"Source data file name")]
2020-04-06 12:04:40 +00:00
public string? Input { get; set; }
2020-01-31 22:38:56 +00:00
2020-04-06 17:14:46 +00:00
protected override async Task<ExitCode> Run()
2020-01-31 22:38:56 +00:00
{
File.ReadAllBytes(Input).ToEcryptedData(Name);
2020-01-31 22:38:56 +00:00
return 0;
}
}
}