コード例 #1
0
 public void PrintFile(string filePath)
 {
     if (!IsPlainText(filePath))
     {
         byte[] decrypted = Decrypt(File.ReadAllBytes(filePath));
         _consolePrinter.Print(Encoding.ASCII.GetString(decrypted));
     }
     else
     {
         _consolePrinter.Print(File.ReadAllText(filePath));
     }
 }
コード例 #2
0
 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));
     }
 }