Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     remark = InputBox.Show(Strings.EnterRemarkMessage, Strings.EnterRemarkTitle, remark);
 }
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (listViewParams.Items.Count > 255)
            {
                MessageBox.Show("Too many arguments not supported!");
                return;
            }
            string[] input = InputBox.ShowParams("Params", "Params");
            if (input == null)
            {
                return;
            }
            switch (input[0])
            {
            case ("byte[]"):
                try
                {
                    byte[] arg = input[1].HexToBytes();
                }
                catch (FormatException)
                {
                    return;
                }
                listViewParams.Items.Add(new ListViewItem(new[]
                {
                    new ListViewItem.ListViewSubItem
                    {
                        Name = "Type",
                        Text = "byte[]"
                    },
                    new ListViewItem.ListViewSubItem
                    {
                        Name = "Data",
                        Text = input[1]
                    }
                }, -1));
                break;

            case ("BigInteger"):
                BigInteger.TryParse(input[1], out BigInteger intResult);
                listViewParams.Items.Add(new ListViewItem(new[]
                {
                    new ListViewItem.ListViewSubItem
                    {
                        Name = "Type",
                        Text = "BigInteger"
                    },
                    new ListViewItem.ListViewSubItem
                    {
                        Name = "Data",
                        Text = intResult.ToString()
                    }
                }, -1));
                break;

            case ("string"):
                listViewParams.Items.Add(new ListViewItem(new[]
                {
                    new ListViewItem.ListViewSubItem
                    {
                        Name = "Type",
                        Text = "string"
                    },
                    new ListViewItem.ListViewSubItem
                    {
                        Name = "Data",
                        Text = input[1]
                    }
                }, -1));
                break;
            }
        }