Beispiel #1
0
        /**
         * Self explanatory - if off, turn on, if on, turn off
         */
        private void ToggleTimer()
        {
            //If the timer isn't running
            if (!tmrInterval.Enabled)
            {
                RefreshRoute();
                //int x;
                if (!Int32.TryParse(new Options().interval, out int x))
                {
                    return;
                }

                tmrInterval.Interval = x;
                tmrInterval.Start();
                btnStart.Text = "Stop";
            }
            else
            {
                startedRun = false;
                tmrInterval.Stop();
                oAreacode      = null;
                btnStart.Text  = "Start";
                tsPrevSegments = TimeSpan.Zero;
            }
        }
Beispiel #2
0
        /**
         * Keeps polling for a save file, when it finds the save file it looks for the areacode
         * If it's the correct areacode, i.e. if it's the first split it triggers the timer
         * This is the only time we update due to areacode in file.
         * We were updating all splits based on file, however this caused issues when
         * LBA was attempting to save the save file and we were attempting to copy it to query
         * which led to the save file not being actually saved and thus the split never changing
         *
         * On finding first split we log DateTime.Now, set the started run flag to true, and set the current run time to 0
         */
        private void RunNotStarted()
        {
            string filePath = null;

            if (!tmrInterval.Enabled)
            {
                return;
            }
            //Keep polling until we have a file
            if (null == oAreacode)
            {
                filePath = CheckNewLBAFileInDir(new Options().LBADir);
                if (null == filePath)
                {
                    return;
                }
                saveFilePath = filePath;
            }
            splitIndex = 0;
            //Check for no splits configured
            if (0 == route.splits.Length)
            {
                ToggleTimer();
                return;
            }
            oAreacode = new AreaCode(saveFilePath);
            //We should have a file
            if (oAreacode.GetAreaCodeMemory() == route.splits[splitIndex].id)
            {
                startedRun = true;
                System.Threading.Thread.Sleep(getInt(new Options().startTimeDelay));
                dtRunStart = DateTime.Now;
                if (new Options().disableAutoZoom)
                {
                    new Mem().WriteVal(0xE0A, 0, 1);
                }
                if (new Options().defaultInventorySquare)
                {
                    new Mem().WriteVal(0x12F4, 27, 1);
                }
                lblTime.Text = TimeSpanToString(dtRunStart - DateTime.Now, true);
            }
        }