Hola:
Puedo cargar un archivo binario, lo lee y muestra datos en los textbox.
Su código del Form1.
Código C++:
Ver originalusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO; // No olvidar.
namespace ROM_SNES
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
FileInfo Archivo = new FileInfo(openFileDialog1.FileName);
SnesKit.RomDump VARIABLE = new SnesKit.RomDump(File.ReadAllBytes(openFileDialog1.FileName.ToString()));
textBox_Nombre_ruta_archivo.Text = openFileDialog1.FileName.ToString(); // Muestra la ruta del archivo.
textBox_Name.Text = VARIABLE.Name;
textBox_Layout.Text = string.Format("{0:X}", VARIABLE.Layout);
textBox_CartridgeType.Text = string.Format("{0:X}", VARIABLE.CartridgeType);
textBox_RomSize.Text = string.Format("{0:X}", VARIABLE.RomSize);
textBox_RamSize.Text = string.Format("{0:X}", VARIABLE.RamSize);
textBox_CountryCode.Text = string.Format("{0:X}", VARIABLE.CountryCode);
textBox_LicenseCode.Text = string.Format("{0:X}", VARIABLE.LicenseCode);
textBox_VersionNumber.Text = string.Format("{0:X}", VARIABLE.VersionNumber);
textBox_BankType.Text = VARIABLE.BankType.ToString();
textBox_Checksum.Text = string.Format("{0:X}", VARIABLE.Checksum);
textBox_ChecksumCompliment.Text = string.Format("{0:X}", VARIABLE.ChecksumCompliment);
textBox_SmcHeader.Text = VARIABLE.SmcHeader ? "True" : "False";
textBox_HeaderLocation.Text = string.Format("{0:X}", VARIABLE.HeaderLocation);
textBox_MB.Text = string.Format("{0:N0}", (Archivo.Length / 1024f) / 1024f); // Resultado 4 MB.
textBox_KB.Text = string.Format("{0:N0}", (Archivo.Length / 1024f)); // 4.907 KB.
textBox_Bytes.Text = string.Format("{0:N0}", Archivo.Length); // 4.194.816 B o Bytes.
textBox_Mbit.Text = string.Format("{0:N0}", ((Archivo.Length / 1024f) / 1024f) * 8); // Mega bits.
}
}
}
}
1) En el cuadro 3 azul, en el textBox que pone M, tiene el número introducido un 4. Quiero que se vea en vez de 4 pelado, que sea así: 4.00 por poner un ejemplo.
A pesar de hechar un ojo por
aquí, no lo logro.
2) En el Cuadro 4 amarillo, donde pone "Nombre del archivo" no me sale. He estado leyendo por
aquí y no me entero aunque lo tenga delante.
¿Cómo se hace?
Un cordial saludo.