Пример #1
0
        public IModsEx GetModsFromEnum(int modsEnum)
        {
            UpdateNoModText();

            var useShortMod = !_settings?.Get <bool>(_names.UseLongMods) ?? true;

            var mods = new ModsEx(useShortMod,
                                  mods: GetModsFromInt(modsEnum),
                                  shortMods: GetModsFromEnum(modsEnum, true),
                                  longMods: GetModsFromEnum(modsEnum, false)
                                  );

            return(mods);
        }
Пример #2
0
        public MapSearchResult FindMapData(MapSearchArgs searchArgs)
        {
            MapSearchResult mapSearchResult = null;
            ModsEx          foundMods       = null;

            for (int i = 0; i < _mapDataFinders.Count; i++)
            {
                if ((_mapDataFinders[i].SearchModes & searchArgs.Status) == 0)
                {
                    continue;
                }
                try
                {
                    mapSearchResult = _mapDataFinders[i].FindBeatmap(searchArgs);
                }
                catch (Exception e)
                {
                    _logger.Log(e, LogLevel.Error);
                    mapSearchResult = null;
                }

                if (mapSearchResult?.FoundBeatmaps == true)
                {
                    if (mapSearchResult.Mods == null && foundMods != null)
                    {
                        mapSearchResult.Mods = foundMods;
                    }
                    _logger.Log(string.Format(">Found data using \"{0}\" ID: {1}", _mapDataFinders[i].SearcherName, mapSearchResult.BeatmapsFound[0]?.MapId), LogLevel.Advanced);
                    break;
                }
                if (mapSearchResult?.Mods != null)
                {
                    foundMods = mapSearchResult.Mods;
                }
            }
            if (mapSearchResult == null)
            {
                mapSearchResult = new MapSearchResult(searchArgs);
            }

            return(mapSearchResult);
        }