private void consultar_Click(object sender, EventArgs e) { String ValPropiedad = propiedad.Text; String res = "NOK"; if (ValPropiedad.Length != 0 && stationList.Text != "") { try { switch (ValPropiedad) { case "Temperatura": res = estacionActual.getTemperatura().ToString(); break; case "Humedad": res = estacionActual.getHumedad().ToString(); break; case "Luminosidad": res = estacionActual.getLuminosidad().ToString(); break; case "Pantalla": res = estacionActual.getPantalla(); break; } crearLog("get", ValPropiedad); if (encriptado) { try { resPropiedad.Text = AesBase64Wrapper.DecodeAndDecrypt(res); } catch (Exception ex) { } } else { resPropiedad.Text = res; } } catch (Exception ex) { error("Esta estación se encuentra inactiva!"); } } else { error(error_propiedad_no_seleccionada); } }
static void Main(string[] args) { string encryptMe; string encrypted; string decrypted; encryptMe = "please encrypt me"; Console.WriteLine("encryptMe = " + encryptMe); encrypted = AesBase64Wrapper.EncryptAndEncode(encryptMe); Console.WriteLine("encypted: " + encrypted); decrypted = AesBase64Wrapper.DecodeAndDecrypt(encrypted); Console.WriteLine("decrypted: " + decrypted); Console.WriteLine("press any key to exit...."); Console.ReadKey(); }