Ejemplo n.º 1
0
    static void Main()
    {
        // Open file to which encrypted string is written
        string     toEncrypt = "Selected site is in Italy.";
        FileStream fs        = null;

        try
        {
            fs = new FileStream(@"\corecsharp\data\testcrypt.txt", FileMode.Create,
                                FileAccess.Write);
            MyApp.WriteEncrypt(fs, toEncrypt);
            fs = new FileStream(@"\corecsharp\data\testcrypt.txt", FileMode.Open,
                                FileAccess.Read);
            string msg = MyApp.ReadEncrypt(fs);
            Console.WriteLine(msg);
        } catch (Exception ex)
        { Console.WriteLine(ex.Message); }
        fs.Close();
        Console.Read();
    }