Skip to content

Commit

Permalink
FilePathToContentBase64
Browse files Browse the repository at this point in the history
  • Loading branch information
Hecate2 committed Sep 12, 2024
1 parent 8fa2477 commit 588d225
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Neo.CLI/CLI/MainService.Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ partial class MainService
[ConsoleCommand("parse", Category = "Base Commands", Description = "Parse a value to its possible conversions.")]
private void OnParseCommand(string value)
{
if (File.Exists(value))
value = Convert.ToBase64String(File.ReadAllBytes(value));
value = Base64Fixed(value);

var parseFunctions = new Dictionary<string, Func<string, string?>>();
Expand Down Expand Up @@ -71,6 +69,16 @@ private void OnParseCommand(string value)
}
}

/// <summary>
/// Read file from path and print its content in base64
/// </summary>
[ParseFunction("File path to content base64")]
private string? FilePathToContentBase64(string path)
{
if (!File.Exists(path)) return null;
return Convert.ToBase64String(File.ReadAllBytes(path));
}

/// <summary>
/// Little-endian to Big-endian
/// input: ce616f7f74617e0fc4b805583af2602a238df63f
Expand Down

0 comments on commit 588d225

Please sign in to comment.