Esempio n. 1
0
        public void RefreshLists()
        {
            listBox1.Items.Clear();
            if (OPCodes.Table == null)
            {
                OPCodes.Table = new List <OPCodes.OPCEntry>();
            }
            bool run = true;

            while (run)
            {
                run = false;
                for (int i = 0; i < OPCodes.Table.Count - 1; i++)
                {
                    if (OPCodes.Table[i].OPCode > OPCodes.Table[i + 1].OPCode)
                    {
                        OPCodes.OPCEntry e = OPCodes.Table[i];
                        OPCodes.Table[i]     = OPCodes.Table[i + 1];
                        OPCodes.Table[i + 1] = e;
                        run = true;
                    }
                }
            }
            foreach (OPCodes.OPCEntry e in OPCodes.Table)
            {
                string s = "OPCode : 0x" + e.OPCode.ToString("X2") + " Pattern: " + e.Pattern;
                listBox1.Items.Add(s);
            }
        }
Esempio n. 2
0
        private void loadTableToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.opc|*.opc";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read);
                BitConverter.IsLittleEndian = true;
                byte[] buff = new byte[4];
                fs.Read(buff, 0, 4);
                int count = BitConverter.ToInt32(buff, 0);
                OPCodes.Table = new List <OPCodes.OPCEntry>();
                for (int i = 0; i < count; i++)
                {
                    OPCodes.OPCEntry en = new OPCodes.OPCEntry();
                    fs.Read(buff, 0, 4);
                    en.OPCode  = BitConverter.ToInt32(buff, 0);
                    en.Pattern = ReadString(fs);
                    OPCodes.Table.Add(en);
                }
                fs.Close();
                RefreshLists();
            }
        }
Esempio n. 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     OPCodes.OPCEntry en = new OPCodes.OPCEntry();
     try
     {
         string text = textBox1.Text.Trim();
         int    i    = Int32.Parse(text, System.Globalization.NumberStyles.HexNumber);
         en.OPCode  = i;
         en.Pattern = textBox2.Text;
         OPCodes.Table.Add(en);
         RefreshLists();
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     OPCodes.OPCEntry en = new OPCodes.OPCEntry();
     try
     {
         string text = textBox1.Text.Trim();
         int i = Int32.Parse(text, System.Globalization.NumberStyles.HexNumber);
         en.OPCode = i;
         en.Pattern = textBox2.Text;
         OPCodes.Table.Add(en);
         RefreshLists();
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 5
0
 private void loadTableToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog d = new OpenFileDialog();
     d.Filter = "*.opc|*.opc";
     if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read);
         BitConverter.IsLittleEndian = true;
         byte[] buff = new byte[4];
         fs.Read(buff, 0, 4);
         int count = BitConverter.ToInt32(buff, 0);
         OPCodes.Table = new List<OPCodes.OPCEntry>();
         for (int i = 0; i < count; i++) 
         {
             OPCodes.OPCEntry en = new OPCodes.OPCEntry();
             fs.Read(buff, 0, 4);
             en.OPCode = BitConverter.ToInt32(buff, 0);
             en.Pattern = ReadString(fs);
             OPCodes.Table.Add(en);
         }
         fs.Close();
         RefreshLists();
     }
 }