6

StreamReader をサブクラス化することで、復号化されたファイル ストリーム リーダー (DFSR) クラスを作成しようとしています。これにより、暗号化された情報を含むファイル名をその (DFSR) コンストラクターに渡し、StreamReader の ReadLine メソッドで呼び出すことができる streamReader を返すことができます。

以下のように行う方法は知っていますが、StreamReaderを親クラスとするクラスに屈折させる方法がわかりません。

using (Rijndael rijAlg = Rijndael.Create())
{
    rijAlg.Key = DX_KEY_32;
    rijAlg.IV = DX_IV_16;

    // Create a decrytor to perform the stream transform.
    using (FileStream fs = File.Open("test.crypt", FileMode.Open))
    {
        using (CryptoStream cs = new CryptoStream(fs, rijAlg.CreateDecryptor(), CryptoStreamMode.Read))
        {
            using (StreamReader sr = new StreamReader(cs))
            {
                string line;
                // Read and display lines from the file until the end of  
                // the file is reached. 
                while ((line = sr.ReadLine()) != null)
                {
                    Console.WriteLine(line);
                }
            }

        }
    }

}
4

1 に答える 1