This C# program encodes or decodes files using Base64. The input file is read from a folder named files, and the result is saved in the same directory.
- If the file is a regular binary file, the program encodes it into Base64 and saves the output as
<original_filename>+base64.txt. - If the file is already Base64-encoded, the program decodes it and restores the original file with a
_decodedsuffix in its name.
files/: This folder contains both input files and the generated Base64-encoded or decoded files.
- Base64 Encoding: Converts the content of a binary file into a Base64 string and saves it in the same directory.
- Base64 Decoding: Detects if a file is already Base64-encoded and decodes it back into its original form.
-
Place the file you want to encode or decode in the
files/folder. -
Run the program, providing the file name as an argument:
dotnet run "yourfile.ext" -
Depending on the file type:
- If the file is not Base64, the program encodes it and saves the output as
yourfile+base64.txtin thefilesfolder. - If the file is Base64-encoded, the program decodes it and saves the decoded file as
yourfile_decoded.extin the samefilesfolder.
- If the file is not Base64, the program encodes it and saves the output as
- Place a file called
example.txtinside thefilesfolder. - Run the program:
dotnet run "example.txt" - The program will check if
example.txtis Base64-encoded or not:- If not, it will encode the file and save
example+base64.txt. - If it is already Base64, it will decode it and save
example_decoded.txt.
- If not, it will encode the file and save
- .NET SDK installed on your machine.
This project is licensed under the MIT License.