Exemplo n.º 1
0
        public void SubmitComboResult(string combo, ResultType resultType, CaptureDictionary captures = null, bool outputResult = true, string file = null, string directory = null)
        {
            _runInformations = RunInformations.GetOrNewInstance();
            _formatUtils     = FormatUtils.GetOrNewInstance();
            _fileUtils       = FileUtils.GetOrNewInstance();
            _consoleUtils    = ConsoleUtils.GetOrNewInstance();

            if (resultType != ResultType.Invalid)
            {
                Interlocked.Increment(ref _runInformations.hits);

                if (resultType == ResultType.Free)
                {
                    Interlocked.Increment(ref _runInformations.free);
                }

                if (outputResult)
                {
                    string output = _formatUtils.FormatOutput(combo, captures != null ? _formatUtils.CaptureDictionaryToString(captures) : null);

                    _fileUtils.WriteLine(output, $"{file ?? (resultType == ResultType.Free ? "Free" : "Hits")}.txt", directory ?? $"Results/{_runInformations.runStartFormattedDate}");

                    _consoleUtils.WriteLine(output, resultType == ResultType.Free ? ConsoleColor.Cyan : ConsoleColor.Green);
                }
            }

            Interlocked.Increment(ref _runInformations.ran);
        }