Esempio n. 1
0
        //static can be called without creating an object for it, void because it will not return a value with no string arguments as parameters
        static void Main()
        {
            //Given an array of  integers and a number, , perform  left rotations on the array. Then print the updated array as a single line of space-separated integers.
            //###
            //get string from user and convert to string array

            DebugMon debug = new DebugMon();

            ValVer validate = new ValVer();

            validate.Sequence = "4 3 2 1";

            //reference physicsforums.com
            //int[] sequence = Convert.ToInt32(Console.ReadLine()).ToString().ToCharArray().Select(x => (int)Char.GetNumericValue(x)).ToArray();
            Console.WriteLine("Please enter a line of integers seperated by spaces");
            //string sequence = Console.ReadLine();
            //This is a pointless line it is just for testing purposes to understand get/set within a field property.
            string sequence = validate.Sequence;


            //Console.WriteLine("Echo Sequence " + sequence);
            debug.DebugVariable(sequence);
            var sequenceArr = sequence.Split(' ');

            int length = sequenceArr.Length;

            Console.WriteLine("Echo Array Length " + length);
            int n = 0;

            for (n = 0; n < length; n++)
            {
                Console.WriteLine("Echo Sequence now as String Array " + sequenceArr[n]);
            }


            //request number of rotations
            Console.WriteLine("How many times would you like to rotate the array to the right?");
            int rotations = 0;

            rotations = Convert.ToInt32(Console.ReadLine());

            if (rotations != 0)
            {
                //intialise constructor for class
                ArrayOperations ops = new ArrayOperations();
                //perform rotations
                ops.RotateArray(rotations, sequenceArr);

                //output state of array after rotations
            }
            else
            {
                Console.WriteLine("You did not enter any rotations.");
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            DebugMon d = new DebugMon();

            d.PauseOnSecondChanceException = true;
            d.EventsMonitored     = DebugMon.EventFilter.All;
            d.ExceptionsMonitored = DebugMon.ExceptionFilter.All;
            if (Process.GetProcessesByName("realplay").Length == 0)
            {
                Process.Start(@"C:\Program Files (x86)\Real\RealPlayer\realplay.exe");
            }

            if (!d.Open("realplay"))
            {
                Console.WriteLine("Unknown error opening RealPlayer");
                return;
            }

            if (!d.StartDebugging())
            {
                Console.Error.WriteLine();
            }

            //d.WaitUntilInitialBreakpointIsHit();
            d.ResumeDebugging();

            // Main command loop.
            string userCommand = string.Empty;

            while (!userCommand.Equals("q") &&
                   !userCommand.Equals("exit") &&
                   !userCommand.Equals("quit"))
            {
                userCommand = Console.ReadLine();
                switch (userCommand)
                {
                // disassemble
                case "d":
                    d.DisassembleCurrentInstruction();
                    break;

                // go
                case "g":
                    d.ResumeDebugging();
                    Console.WriteLine("[+] Resumed.");
                    break;

                // pause
                case "p":
                    if (d.PauseDebugging())
                    {
                        Console.WriteLine("[+] Paused successfully.");
                    }
                    else
                    {
                        Console.WriteLine("[-] Pause unsuccessful.");
                    }

                    break;

                // registers
                case "r":
                    break;

                // step into
                case "si":
                    d.StepInto();
                    break;

                // step over
                case "so":
                    d.StepOver();
                    break;

                default:
                    break;
                }
            }

            if (!d.StopDebugging())
            {
                Console.Error.WriteLine("Could not stop debugging.");
            }

            Console.WriteLine();
        }