Example #1
0
        /// <summary>
        /// initializes the ReplayService. This is when the log file is actually loaded into memory.
        /// </summary>
        public void init()
        {
            allLines    = File.ReadAllLines(logFilePath);
            updatesLeft = getUpdateCount();

            RandCommand rc = (RandCommand)LogCommand.parse(allLines[0]);

            Rand.Instance.Seed = rc.Seed;


            lineNumber = 1;
        }
Example #2
0
        private InputCommand getInputOnLine()
        {
            try
            {
                string line = readLine(lineNumber);

                LogCommand command = LogCommand.parse(line);
                while (!(command is InputCommand))
                {
                    lineNumber++;
                    command = LogCommand.parse(readLine(lineNumber));
                }

                InputCommand io = (InputCommand)command;
                return(io);
            }
            catch (LogOverException e)
            {
                replayOver = true;
                return(new InputCommand(0, 0, new List <Keys>(), Mouse.GetState()));
            }
        }
Example #3
0
        /// <summary>
        /// Gets the number of times to spend on the current line in the log file
        /// </summary>
        /// <returns></returns>
        private long getUpdateCount()
        {
            try
            {
                string line = readLine(lineNumber);

                LogCommand command = LogCommand.parse(line);
                while (!(command is InputCommand))
                {
                    lineNumber++;
                    command = LogCommand.parse(readLine(lineNumber));
                }


                InputCommand io = (InputCommand)command;
                return(io.Duration);
            }
            catch (LogOverException e)
            {
                replayOver = true;
                return(-1);
            }
        }