Exemple #1
0
        /// <summary>
        /// Outputs or saves the hex dump to a file.
        /// </summary>
        /// <param name="file">Path of file for hexdump.</param>
        /// <param name="saveToFile">True for save output to a file.</param>
        /// <param name="savePath">File path and name where to store the dump.</param>
        private static void HexDumpFile(string file, bool saveToFile, string savePath)
        {
            if (File.Exists(file))
            {
                byte[] getBytes = File.ReadAllBytes(file);
                if (saveToFile)
                {
                    Console.WriteLine(FileSystem.SaveFileOutput(savePath, s_currentDirectory, HexDump.Hex(getBytes, 16), true));
                    return;
                }
                Console.WriteLine(HexDump.Hex(getBytes, 16));
                return;
            }

            FileSystem.ErrorWriteLine($"File {file} does not exist");
        }