Ejemplo n.º 1
0
        public Collections GetPlayersCollections(CollectionGeneratorConfiguration cfg, LogCollectionGeneration logger)
        {
            int totalUsernames   = cfg.Usernames.Count;
            int processedCounter = 0;
            var c = new Collections();

            _osuApi.ApiKey = cfg.ApiKey;
            _logger        = logger;
            _logger?.Invoke(StartingProcessing, 0d);
            _collectionManager.EditCollection(CollectionEditArgs.ClearCollections());
            try
            {
                foreach (var username in cfg.Usernames)
                {
                    var collections = GetPlayerCollections(username,
                                                           cfg.CollectionNameSavePattern, cfg.ScoreSaveConditions);
                    Log(username, ParsingFinished,
                        ++processedCounter / (double)totalUsernames * 100);
                    _collectionManager.EditCollection(CollectionEditArgs.AddOrMergeCollections(collections));
                }

                c.AddRange(_collectionManager.LoadedCollections);
                _logger?.Invoke(string.Format(ParsingFinished, cfg.Usernames.Count), 100);

                _logger = null;
                return(c);
            }
            catch (ThreadAbortException)
            {
                _logger?.Invoke(Aborted, -1d);
                return(c);
            }
        }
Ejemplo n.º 2
0
 private void ClearCollections(object sender, object data = null)
 {
     _collectionEditor.EditCollection(CollectionEditArgs.ClearCollections());
 }
 private void ClearCollections()
 {
     _collectionEditor.EditCollection(CollectionEditArgs.ClearCollections());
 }