Пример #1
0
        public string FormatTitle(string text)
        {
            text = text
                   .Replace("%program.name%", _programInformations._name)
                   .Replace("%program.version%", _programInformations._version)
                   .Replace("%program.author%", _programInformations._author)

                   .Replace("%lists.combos%", _runLists.Combos.Count.ToString())
                   .Replace("%lists.proxies%", _runLists.Combos.Count.ToString())

                   .Replace("%run.ran%", _runInformations.Ran.ToString())
                   .Replace("%run.remaining%", (_runLists.Combos.Count - _runInformations.Ran).ToString())
                   .Replace("%run.hits%", _runInformations.Hits.ToString())
                   .Replace("%run.free%", _runInformations.Free.ToString())

                   .Replace("%run.ran.percentage%", _runLists.Combos.Count == 0 ? "0.00%" : ((double)_runInformations.Ran / (double)_runLists.Combos.Count).ToString("0.00%"))
                   .Replace("%run.hits.percentage%", _runInformations.Ran == 0 ? "0.00%" : ((double)_runInformations.Hits / (double)_runInformations.Ran).ToString("0.00%"))
                   .Replace("%run.free.percentage%", _runInformations.Hits == 0 ? "0.00%" : ((double)_runInformations.Free / (double)_runInformations.Hits).ToString("0.00%"))

                   .Replace("%statistics.rpm%", _runStatistics.RanPerMinute.ToString())
                   .Replace("%statistics.elapsed%", _runStatistics.GetElapsedTime())
                   .Replace("%statistics.estimated%", _runStatistics.GetEstimatedTime());

            lock (_customStatistics.CustomStatisticsLocker)
                foreach (var customStatistic in _customStatistics.CustomStatisticsDictionary)
                {
                    text = text
                           .Replace($"%custom.{customStatistic.Key.Replace(" ", "_")}%", customStatistic.Value.ToString())
                           .Replace($"%custom.{customStatistic.Key.Replace(" ", "_")}.percentage%", customStatistic.Value == 0 ? "0.00%" : ((double)customStatistic.Value / (double)_runInformations.Hits).ToString("0.00%"));
                }

            return(text);
        }