Esempio n. 1
0
        public static Result Start([NotNull] IAcsStarter starter, [NotNull] StartProperties properties)
        {
            if (starter == null)
            {
                throw new ArgumentNullException(nameof(starter));
            }
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            if (_busy)
            {
                return(null);
            }
            _busy = true;

            RemoveResultJson();
            var start = DateTime.Now;

            try {
                properties.Set();
                if (OptionRaceIniTestMode)
                {
                    return(null);
                }

                starter.Run();
                starter.WaitUntilGame();
                starter.WaitGame();
            } finally {
                starter.CleanUp();

                _busy = false;
                properties.RevertChanges();
            }

            return(GetResult(start));
        }