Beispiel #1
0
 void btnBuscar_Click(object sender, RoutedEventArgs e)
 {
     byte[] bytesText = BloqueString.ToByteArray(txtTextoABuscar.Text);
     bytesText        = bytesText.SubArray(bytesText.Length - 1); //quito el FE para que busque frases sin acabar
     lenght           = bytesText.Length;
     offsetEncontrado = rom.Data.SearchArray(bytesText);
     if (Encontrado)
     {
         this.Close();
     }
     else
     {
         tbMensajeNoEncontrado.Visibility = Visibility.Visible;
     }
 }
        void BtnCargarTexto_Click(object sender, RoutedEventArgs e)
        {
            const char INDICADORHEX = 'x';
            int        offset, lenght;

            txtTextoCargado.Text = "";
            if (!string.IsNullOrEmpty(txtOffset.Text) && !string.IsNullOrEmpty(txtLongitud.Text))
            {
                try{
                    if (txtOffset.Text.Length > 2 && txtOffset.Text[1] == INDICADORHEX)
                    {
                        offset = (int)((Hex)txtOffset.Text.Substring(2));
                    }
                    else
                    {
                        offset = Convert.ToInt32(txtOffset.Text);
                    }

                    if (txtLongitud.Text.Length > 2 && txtLongitud.Text[1] == INDICADORHEX)
                    {
                        lenght = (int)((Hex)txtLongitud.Text.Substring(2));
                    }
                    else
                    {
                        lenght = Convert.ToInt32(txtLongitud.Text);
                    }

                    txtTextoCargado.Text = BloqueString.ToString(rom.Data.SubArray(offset, lenght));
                }catch {
                    MessageBox.Show("El formato para escribir en hexadecimal es 0xNumero en hexadecimal, si no ha sido por eso te has pasado con el numero...es demasiado grande", "A Ocurrido un error", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show("falts poner la informacion para la traducción [inicio,longitud]", "Atención", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }