Exemplo n.º 1
0
        static void CryptoFile(ICrypt _cryptFiles)
        {
            Console.Write("Please enter full name directory with files: ");
            string directory_name = Console.ReadLine();

            Console.Write("Please enter password: "******"1. Encrypt file");
            Console.WriteLine("2. Decrypt file");

            char e = Console.ReadKey().KeyChar;

            switch (e)
            {
            case (char)49:
                //Console.WriteLine($"Start encrypt file: {file_name}");
                Console.WriteLine($"Start encrypt");
                _cryptFiles.EncryptAsync(PasswordToByte(password), GetFiles(@directory_name));
                //Console.WriteLine($"File - {file_name}, encrypted!");
                break;

            case (char)50:
                //Console.WriteLine($"Start decrypt file: {file_name}");
                _cryptFiles.DecryptAsync(PasswordToByte(password), GetFiles(@directory_name));
                break;
            }
            Console.WriteLine("----");
            Console.ReadKey();
        }