Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Read Button
            string sAddress = textBox1.Text;
            string type     = comboBox1.Text;

            if (type == "Int16")
            {
            }
            else if (type == "Int32")
            {
                Int32 value = MM.ReadInt32(new IntPtr(long.Parse(sAddress)));
                textBox2.Text = value.ToString();
            }
            else if (type == "UInt32")
            {
                UInt32 value = MM.ReadUInt32(new IntPtr(long.Parse(sAddress)));
                textBox2.Text = value.ToString();
            }
            else if (type == "Int64")
            {
                Int64 value = MM.ReadInt64(new IntPtr(long.Parse(sAddress)));
                textBox2.Text = value.ToString();
            }
            else if (type == "UInt64")
            {
                UInt64 value = MM.ReadUInt64(new IntPtr(long.Parse(sAddress)));
                textBox2.Text = value.ToString();
            }
            else if (type == "Float")
            {
                float value = MM.ReadFloat(new IntPtr(long.Parse(sAddress)));
                textBox2.Text = value.ToString();
            }
            else if (type == "Double")
            {
            }
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            // Update
            Core.Output("Updating results, showing only ones with new value...");
            string val  = textBox1.Text;
            string type = comboBox1.Text;

            if (type == "Int16")
            {
            }
            else if (type == "Int32")
            {
                Int32         value = Int32.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, Int32> > data    = (List <Tuple <IntPtr, Int32> >)s.DataSource;
                List <Tuple <IntPtr, Int32> > newdata = new List <Tuple <IntPtr, Int32> >();
                foreach (Tuple <IntPtr, Int32> t in data)
                {
                    Int32 nval = MM.ReadInt32(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, Int32>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "UInt32")
            {
                UInt32        value = UInt32.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, UInt32> > data    = (List <Tuple <IntPtr, UInt32> >)s.DataSource;
                List <Tuple <IntPtr, UInt32> > newdata = new List <Tuple <IntPtr, UInt32> >();
                foreach (Tuple <IntPtr, UInt32> t in data)
                {
                    UInt32 nval = MM.ReadUInt32(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, UInt32>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "Int64")
            {
                Int64         value = Int64.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, Int64> > data    = (List <Tuple <IntPtr, Int64> >)s.DataSource;
                List <Tuple <IntPtr, Int64> > newdata = new List <Tuple <IntPtr, Int64> >();
                foreach (Tuple <IntPtr, Int64> t in data)
                {
                    Int64 nval = MM.ReadInt64(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, Int64>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "UInt64")
            {
                UInt64        value = UInt64.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, UInt64> > data    = (List <Tuple <IntPtr, UInt64> >)s.DataSource;
                List <Tuple <IntPtr, UInt64> > newdata = new List <Tuple <IntPtr, UInt64> >();
                foreach (Tuple <IntPtr, UInt64> t in data)
                {
                    UInt64 nval = MM.ReadUInt64(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, UInt64>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "Float")
            {
                float         value = float.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, float> > data    = (List <Tuple <IntPtr, float> >)s.DataSource;
                List <Tuple <IntPtr, float> > newdata = new List <Tuple <IntPtr, float> >();
                foreach (Tuple <IntPtr, float> t in data)
                {
                    float nval = MM.ReadFloat(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, float>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "Double")
            {
                double        value = double.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, double> > data    = (List <Tuple <IntPtr, double> >)s.DataSource;
                List <Tuple <IntPtr, double> > newdata = new List <Tuple <IntPtr, double> >();
                foreach (Tuple <IntPtr, double> t in data)
                {
                    double nval = MM.ReadDouble(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, double>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
        }