OpenRA.ModMetadata.GetCandidateMods C# (CSharp) Method

GetCandidateMods() static private method

static private GetCandidateMods ( ) : string>>.IEnumerable
return string>>.IEnumerable
        static IEnumerable<Pair<string, string>> GetCandidateMods()
        {
            // Get mods that are in the game folder.
            var basePath = Platform.ResolvePath(Path.Combine(".", "mods"));
            var mods = Directory.GetDirectories(basePath)
                .Select(x => Pair.New(x.Substring(basePath.Length + 1), x))
                .ToList();

            foreach (var m in Directory.GetFiles(basePath, "*.oramod"))
                mods.Add(Pair.New(Path.GetFileNameWithoutExtension(m), m));

            // Get mods that are in the support folder.
            var supportPath = Platform.ResolvePath(Path.Combine("^", "mods"));
            if (!Directory.Exists(supportPath))
                return mods;

            foreach (var pair in Directory.GetDirectories(supportPath).ToDictionary(x => x.Substring(supportPath.Length + 1)))
                mods.Add(Pair.New(pair.Key, pair.Value));

            foreach (var m in Directory.GetFiles(supportPath, "*.oramod"))
                mods.Add(Pair.New(Path.GetFileNameWithoutExtension(m), m));

            return mods;
        }