Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support file path to base64 in parse #3487

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Hecate2
Copy link
Contributor

@Hecate2 Hecate2 commented Sep 12, 2024

Description

An enhancement for #3482 (but also works alone). Hex string input had already been supported in the method Base64Fixed, and is not considered.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update (maybe)

How Has This Been Tested?

  • Test A
    parse C:\Users\some_file.nef_or_anything
    Typically it prints quite a few screens of hex, base64 and instructions, if the input is a .nef path. It works when the input path includes spaces. The user can wrap the input path with or without double quotation marks ", whether the path includes spaces or not.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@superboyiii
Copy link
Member

For NEF base64, seems not with the same way. But maybe create another method like parseNEF is a good way.
image

@Hecate2
Copy link
Contributor Author

Hecate2 commented Sep 12, 2024

For NEF base64, seems not with the same way. But maybe create another method like parseNEF is a good way.

I see. This is base64(base64(.nefFile))

@Hecate2 Hecate2 changed the title support path input in parse support file path to base64 in parse Sep 12, 2024
@Hecate2
Copy link
Contributor Author

Hecate2 commented Sep 12, 2024

Changed this PR to support only file path to base64

{
if (!File.Exists(path)) return null;
return Convert.ToBase64String(File.ReadAllBytes(path));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I don't think we need this command for CLI because it's always possible to cat file.txt | base64.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

windows?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also possible but the command is a bit longer.

[ParseFunction("File path to content base64")]
private string? FilePathToContentBase64(string path)
{
if (!File.Exists(path)) return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it allow only nef file extensions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants