static void Main(string[] args) { //TimeBomb bomb = new TimeBomb(DateTime.Now.AddSeconds(3), (DetonateEvent e) => { Console.WriteLine("Boom!"); }); //create a crypto stream writer Rijndael crypt = Rijndael.Create(); ICryptoTransform transform = crypt.CreateEncryptor(); FileStream fs = new FileStream("Encrypt.bin", FileMode.Create); CryptoStream cs = new CryptoStream(fs, transform, CryptoStreamMode.Write); byte[] pass = crypt.Key; BinaryWriter write = new BinaryWriter(cs); write.Write(DateTime.Now.AddSeconds(10).ToString()); write.Flush(); write.Close(); TimeBomb bomb = new TimeBomb("Encrypt.bin", crypt, (DetonateEvent e) => { Console.WriteLine("Boom!"); }, Decrypt); bomb.thrd.Join(); Console.Write("Press any key to continue... "); Console.ReadLine(); }//end main
static void Main(string[] args) { //TimeBomb bomb = new TimeBomb(DateTime.Now.AddSeconds(3), (DetonateEvent e) => { Console.WriteLine("Boom!"); }); //create a crypto stream writer Rijndael crypt = Rijndael.Create(); ICryptoTransform transform = crypt.CreateEncryptor(); FileStream fs = new FileStream("Encrypt.bin", FileMode.Create); CryptoStream cs = new CryptoStream(fs, transform, CryptoStreamMode.Write); byte[] pass = crypt.Key; BinaryWriter write = new BinaryWriter(cs); write.Write(DateTime.Now.AddSeconds(10).ToString()); write.Flush(); write.Close(); TimeBomb bomb = new TimeBomb("Encrypt.bin", crypt, (DetonateEvent e) => { Console.WriteLine("Boom!"); }, Decrypt); bomb.thrd.Join(); Console.Write("Press any key to continue... "); Console.ReadLine(); }