Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string filePath = this.textBox1.Text;

            if (!File.Exists(filePath))
            {
                return;
            }
            using (FileStream stream = new FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read))
            {
                byte[] buffer = new byte[stream.Length];
                stream.Read(buffer, 0, (int)stream.Length);
                AutoDetector dector  = new AutoDetector();
                Encoding     encoder = null;
                string       encode  = dector.DetectEncoding(buffer, ref encoder);
                MessageBox.Show(encode);
            }
        }
Exemplo n.º 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     this.dataGridView1.DataSource = AutoDetector.GetEncodings();
 }