Beispiel #1
0
        private void performTests(Disassembly disasm)
        {
            // perform assembler test
            if (!this.assemblerSuccess)
            {
                this.buttonCheckAssemblerSuccess.Background = Brushes.Red;
                resetAllErrorTags();
                // return so no the rest of the test won't be performed
                return;
            }

            this.buttonCheckAssemblerSuccess.Background = Brushes.Green;

            // perform null byte test
            if (Settings.getCheckContainsNullByte())
            {
                this.buttonCheckNullByte.Background = Brushes.Green;
                foreach (DisassemblyLine dl in disasm.getLines())
                {
                    if ((DataManipulation.splitEveryNChars(dl.getOpcodes(), 2)).Contains("00"))
                    {
                        this.buttonCheckNullByte.Background = Brushes.Red;
                    }
                }
                this.buttonCheckNullByte.IsEnabled = true;
            }
            else
            {
                resetErrorTag(this.buttonCheckNullByte);
            }

            // perform max size test
            if (Settings.getCheckMaxSize())
            {
                if (disasm.getSize() > Settings.getMaxSize())
                {
                    this.buttonCheckMaxSize.Background = Brushes.Red;
                }
                else
                {
                    this.buttonCheckMaxSize.Background = Brushes.Green;
                }
                this.buttonCheckMaxSize.IsEnabled = true;
            }
            else
            {
                resetErrorTag(this.buttonCheckMaxSize);
            }
        }
        public string getAllOpcodes()
        {
            string st = "";

            foreach (DisassemblyLine dl in this.lines)
            {
                foreach (string _byte in DataManipulation.splitEveryNChars(dl.getOpcodes(), 2))
                {
                    st += _byte + '-';
                }
            }
            if (st.LastIndexOf('-') >= 0)
            {
                st = st.Remove(st.LastIndexOf('-'), 1);
            }

            return(st);
        }