コード例 #1
0
ファイル: Console.cs プロジェクト: Jidou/schletter-timing
        private void Timing(string[] input)
        {
            if (input[0] == "rm")
            {
                var memoryDump  = _timingValueService.WaitForBulk();
                var currentRace = _raceService.LoadCurrentRace();
                _timingValueService.SaveChangesToRaceFolder(currentRace, memoryDump);
                return;
            }

            if (input.Length < 2)
            {
                logger.Info("Invalid input, redirect to Timing Menu");
                Timing();
                return;
            }

            //if (input[0] == "s") {
            //    var currentRace = _raceService.LoadCurrentRace();
            //    _timingValueService.SaveChangesToRaceFolder(currentRace);
            //    return;
            //}

            if (input[0] == "l")
            {
                var currentRace = _raceService.LoadCurrentRace();
                _timingValueService.LoadLatestValuesFromRaceFolder(currentRace.Titel);
                return;
            }

            if (input.Length < 3)
            {
                logger.Info("Invalid input, redirect to Timing Menu");
                Timing();
                return;
            }
        }
コード例 #2
0
        public IEnumerable <Dto.TimingValue> GetTimes(bool getLiveData)
        {
            List <TimingValue> timingValues;
            var currentRace = _raceService.LoadCurrentRace();

            if (getLiveData)
            {
                timingValues = _timingValueService.WaitForBulk();
                _timingValueService.SaveChangesToRaceFolder(currentRace, timingValues);
            }
            else
            {
                timingValues = _timingValueService.LoadLatestValuesFromRaceFolder(currentRace.Titel).ToList();

                if (!timingValues.Any())
                {
                    timingValues = _timingValueService.WaitForBulk();
                    _timingValueService.SaveChangesToRaceFolder(currentRace, timingValues);
                }
            }


            return(ConvertTimingValuesModelToDto(timingValues));
        }