Exemplo n.º 1
0
 private void Bt_Abrir_Click(object sender, EventArgs e)
 {
     Ofd1.Filter = "Imagem|*.jpg|Imagem|*.jpeg|Imagem|*.bmp|Imagem|*.png";
     if (Ofd1.ShowDialog() == DialogResult.OK)
     {
         bitmap       = new Bitmap(@Ofd1.FileName);
         Pb1.Location = new Point((Pnl1.Width - bitmap.Width) / 2, (Pnl1.Height - bitmap.Height) / 2 + 140);
         Pb1.Size     = bitmap.Size;
         Pb1.Image    = bitmap;
         Log($"Imagem \"{Path.GetFileName(Ofd1.FileName)}\" carregada.");
     }
 }
Exemplo n.º 2
0
 private void BtnSeleccionarArchivo_Click(object sender, EventArgs e)
 {
     Ofd1.Filter = "Cert|*.p12";
     if (Ofd1.ShowDialog() == DialogResult.OK)
     {
         rutayArchivo           = Ofd1.FileName;
         ruta                   = rutayArchivo.Substring(0, rutayArchivo.LastIndexOf('\\'));
         certificadoP12         = Ofd1.SafeFileName;
         TxtPath.Text           = rutayArchivo;
         LblDragAndDrop.Visible = false;
     }
 }
Exemplo n.º 3
0
        private void BtnAbrirArchivoCodificado_Click(object sender, EventArgs e)
        {
            if (Ofd1.ShowDialog() == DialogResult.OK)
            {
                BtnDecodificarArchivo.Enabled = true;
                BtnCodificarArchivo.Enabled   = false;
                LblDragAndDrop.Visible        = false;
                ruta          = Ofd1.FileName;
                rutayArchivo  = ruta.Substring(0, ruta.LastIndexOf('\\'));
                TxtRuta.Text  = ruta;
                nombreArchivo = Ofd1.SafeFileName;

                flujoEntrada         = new StreamReader(ruta);
                textoCodificado      = flujoEntrada.ReadToEnd();
                TxtArchivoLeido.Text = textoCodificado;
            }
        }
Exemplo n.º 4
0
        private void BtnAbrirArchivoNormal_Click(object sender, EventArgs e)
        {
            if (Ofd1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    BtnDecodificarArchivo.Enabled = false;
                    BtnCodificarArchivo.Enabled   = true;
                    ruta         = Ofd1.FileName;
                    TxtRuta.Text = ruta;

                    flujoEntrada = new StreamReader(ruta);
                    textoNormal  = flujoEntrada.ReadToEnd();

                    string parsedXml = string.Empty;
                    parsedXml            = textoNormal;
                    TxtArchivoLeido.Text = System.Xml.Linq.XDocument.Parse(parsedXml).ToString();
                }
                catch (XmlException ex)
                {
                    MessageBox.Show("El archivo leído no es un XML válido", "Error de lectura", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }