Beispiel #1
0
        public void save()
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.InitialDirectory = "c:\\";
            saveFileDialog.Filter           = "HyperViper Call List (*.hvcl)|*.hvcl|All files (*.*)|*.*";
            saveFileDialog.FilterIndex      = 0;
            saveFileDialog.RestoreDirectory = true;

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                uint  callnr   = UInt32.Parse(txtCallnr.Text);
                uint  count    = UInt32.Parse(txtCount.Text);
                uint  start    = UInt32.Parse(txtStart.Text);
                uint  outSize  = UInt32.Parse(txtOutSize.Text);
                ulong inputInt = (ulong)HypercallConversions.hypercallInput(callnr, optFast.Checked, count, start);

                byte[] inputBuffer = new byte[hexBoxIn.ByteProvider.Length];
                for (int x = 0; x < inputBuffer.Length; x++)
                {
                    inputBuffer[x] = hexBoxIn.ByteProvider.ReadByte(x);
                }

                HVCL.save(saveFileDialog.FileName, inputInt, inputBuffer);
            }
        }
        private void MenuItemOpen(Object sender, System.EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "c:\\";
            openFileDialog.Filter           = "HyperViper Call List (*.hvcl)|*.hvcl|All files (*.*)|*.*";
            openFileDialog.FilterIndex      = 0;
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                List <HypercallStruct> calls = HVCL.open(openFileDialog.FileName);
                if (calls == null)
                {
                    MessageBox.Show("Opening file failed");
                    return;
                }

                if (calls.Count > 1)
                {
                    HypercallSelectionForm selectionWindow = new HypercallSelectionForm(this, calls);
                    selectionWindow.Show();
                }
                else
                {
                    if (calls.Count == 1)
                    {
                        addHypercall(calls[0].code, calls[0].input);
                    }
                    else
                    {
                        MessageBox.Show("This file contained no hypercalls");
                    }
                }
            }
        }