示例#1
0
        public void UpdateTitle()
        {
            _runInformations = RunInformations.GetOrNewInstance();
            _consoleSettings = ConsoleSettings.GetOrNewInstance();
            _formatUtils     = FormatUtils.GetOrNewInstance();

            string title = null;

            switch (_runInformations.runStatus)
            {
            case RunInformations.RunStatus.Idle:
            {
                title = _formatUtils.FormatTitle(_consoleSettings.idleTitleFormat);

                break;
            }

            case RunInformations.RunStatus.Running:
            {
                title = _formatUtils.FormatTitle(_consoleSettings.runningTitleFormat);

                break;
            }

            case RunInformations.RunStatus.Finished:
            {
                title = _formatUtils.FormatTitle(_consoleSettings.finishedTitleFormat);

                break;
            }
            }

            Console.Title = title;
        }
示例#2
0
        public MilkyManager()
        {
            KeyboardListener = KeyboardListener.GetOrNewInstance();

            ConsoleLoops    = ConsoleLoops.GetOrNewInstance();
            LoopsManager    = LoopsManager.GetOrNewInstance();
            StatisticsLoops = StatisticsLoops.GetOrNewInstance();

            OutputSettings = OutputSettings.GetOrNewInstance();

            ProgramInformations = ProgramInformations.GetOrNewInstance();
            ProgramManager      = ProgramManager.GetOrNewInstance();

            RunInformations = RunInformations.GetOrNewInstance();
            RunLists        = RunLists.GetOrNewInstance();
            RunManager      = RunManager.GetOrNewInstance();

            ConsoleSettings = ConsoleSettings.GetOrNewInstance();
            RunSettings     = RunSettings.GetOrNewInstance();

            CustomStatistics = CustomStatistics.GetOrNewInstance();
            RunStatistics    = RunStatistics.GetOrNewInstance();

            ConsoleUtils  = ConsoleUtils.GetOrNewInstance();
            DateTimeUtils = DateTimeUtils.GetOrNewInstance();
            FileUtils     = FileUtils.GetOrNewInstance();
            FormatUtils   = FormatUtils.GetOrNewInstance();
            HashUtils     = HashUtils.GetOrNewInstance();
            ListUtils     = ListUtils.GetOrNewInstance();
            RequestUtils  = RequestUtils.GetOrNewInstance();
            StringUtils   = StringUtils.GetOrNewInstance();
            UserUtils     = UserUtils.GetOrNewInstance();
        }
示例#3
0
        public string GetElapsedTime()
        {
            _dateTimeUtils   = DateTimeUtils.GetOrNewInstance();
            _runInformations = RunInformations.GetOrNewInstance();

            return(TimeSpan.FromSeconds(_dateTimeUtils.GetCurrentUnixTimeSeconds() - _runInformations.runStartUnixTimeSeconds).ToString());
        }
示例#4
0
        public void StartListening()
        {
            _runInformations  = RunInformations.GetOrNewInstance();
            _customStatistics = CustomStatistics.GetOrNewInstance();

            Task.Run(() =>
            {
                while (_runInformations.runStatus == RunInformations.RunStatus.Running)
                {
                    if (Console.KeyAvailable)
                    {
                        ConsoleKeyInfo pressed = Console.ReadKey(true);

                        switch (pressed.Key)
                        {
                        case ConsoleKey.S:
                            {
                                _customStatistics.DisplayCustomStatistics();

                                break;
                            }
                        }
                    }

                    Thread.Sleep(100);
                }
            });
        }
示例#5
0
        public void StartTitleUpdateLoop()
        {
            _runInformations = RunInformations.GetOrNewInstance();
            _consoleUtils    = ConsoleUtils.GetOrNewInstance();
            _dateTimeUtils   = DateTimeUtils.GetOrNewInstance();

            Task.Run(() =>
            {
                while (_runInformations.runStatus != RunInformations.RunStatus.Finished)
                {
                    _consoleUtils.UpdateTitle();

                    Thread.Sleep(_dateTimeUtils.SecondsToMilliseconds(1));
                }
            });
        }
示例#6
0
        public void StartRanPerMinuteLoop()
        {
            _runInformations = RunInformations.GetOrNewInstance();
            _runStatistics   = RunStatistics.GetOrNewInstance();
            _dateTimeUtils   = DateTimeUtils.GetOrNewInstance();

            Task.Run(() =>
            {
                while (_runInformations.runStatus != RunInformations.RunStatus.Finished)
                {
                    int ranBefore = _runInformations.ran;
                    Thread.Sleep(_dateTimeUtils.SecondsToMilliseconds(3));
                    int ranAfter = _runInformations.ran;

                    _runStatistics.ranPerMinute = (ranAfter - ranBefore) * 20;
                }
            });
        }
示例#7
0
        public string GetEstimatedTime()
        {
            _runLists        = RunLists.GetOrNewInstance();
            _runInformations = RunInformations.GetOrNewInstance();

            int estimatedSeconds;

            try
            {
                estimatedSeconds = (_runLists.combos.Count - _runInformations.ran) / (ranPerMinute / 60);
            }
            catch
            {
                estimatedSeconds = 0;
            }

            return(TimeSpan.FromSeconds(estimatedSeconds).ToString());
        }
示例#8
0
        public string FormatTitle(string text)
        {
            _programInformations = ProgramInformations.GetOrNewInstance();
            _runInformations     = RunInformations.GetOrNewInstance();
            _runLists            = RunLists.GetOrNewInstance();
            _runStatistics       = RunStatistics.GetOrNewInstance();
            _customStatistics    = CustomStatistics.GetOrNewInstance();
            _outputSettings      = OutputSettings.GetOrNewInstance();

            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.customStatistics)
                {
                    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);
        }