Ejemplo n.º 1
0
        private bool GetDebugParameters()
        {
            //Run form with defaults from settings if available
            RunForm runForm     = new RunForm(_debugger.ABI, _debugger.Tests, _debugger.ContractName, _settings.lastPrivateKey, _settings.lastParams, _settings.lastFunction);
            var     result      = runForm.ShowDialog();
            var     debugParams = runForm.DebugParameters;

            if (result != DialogResult.OK)
            {
                return(false);
            }

            if (runForm.currentMethod != null)
            {
                _settings.lastFunction = runForm.currentMethod.name;
            }

            _debugger.SetDebugParameters(debugParams);
            return(true);
        }
Ejemplo n.º 2
0
        private bool ResetDebugger()
        {
            if (string.IsNullOrEmpty(targetAVMPath))
            {
                MessageBox.Show("Please load an .avm file first!");
                return(false);
            }

            if (this.debugger == null)
            {
                this.debugger = new NeoEmulator(blockchain);

                var address = blockchain.FindAddressByName(this.contractName);

                if (address == null)
                {
                    address = blockchain.DeployContract(this.contractName, this.contractBytecode);
                    SendLogToPanel($"Deployed contract {contractName} on virtual blockchain.");
                }
                else
                {
                    if (!address.byteCode.SequenceEqual(this.contractBytecode))
                    {
                        address.byteCode = this.contractBytecode;
                        SendLogToPanel($"Updated contract {contractName} bytecode.");
                    }
                }

                this.debugger.SetExecutingAddress(address);
            }

            runForm.mainForm            = this;
            runForm.currentContractName = contractName;
            runForm.emulator            = this.debugger;
            runForm.abi = abi;

            var result = runForm.ShowDialog();

            if (result != DialogResult.OK)
            {
                return(false);
            }

            RemoveCurrentHighlight();

            /*currentLine = ResolveLine(0);
             * if (currentLine > 0 )
             * {
             *  TextArea.Lines[currentLine].MarkerAdd(STEP_BG);
             * }*/

            currentLine = -1;

            shouldReset = false;

            logView.Clear();
            stackPanel.Clear();

            UpdateGasCost();

            return(true);
        }