public void DecryptFile(string filePath) { if (File.Exists(filePath) && !IsPlainText(filePath)) { IDecryptor decryptor = _keyProvider.GetDecryptor(); byte[] decryptedbytes = decryptor.Transform(File.ReadAllBytes(filePath)); File.WriteAllBytes(filePath, decryptedbytes); } }
public void PrintFile(string filePath) { if (File.Exists(filePath) && !IsPlainText(filePath)) { IDecryptor decryptor = _keyProvider.GetDecryptor(); byte[] decryptedBytes = decryptor.Transform(File.ReadAllBytes(filePath)); _printer.Print(Encoding.ASCII.GetString(decryptedBytes)); } else { _printer.Print(File.ReadAllText(filePath)); } }