Candy.Client.Models.ApplicationManager.SuggestApplicationDirectory C# (CSharp) Méthode

SuggestApplicationDirectory() public static méthode

public static SuggestApplicationDirectory ( IReadOnlyList apps ) : string
apps IReadOnlyList
Résultat string
        public static string SuggestApplicationDirectory(IReadOnlyList<InstalledApplication> apps)
        {
            if (apps.Count == 1)
            {
                var candy = apps[0];
                var dir = new DirectoryInfo(Path.GetDirectoryName(candy.InstalledPath));
                var candyDirPattern = new Regex("(Candy|キャンディ|きゃんでぃ)");
                var suggested = EnumerateParents(dir).FirstOrDefault(x => !candyDirPattern.IsMatch(x.FullName));

                return suggested != null ? suggested.FullName : null;
            }
            else
            {
                var path = ScanCommonPrefix(apps.Select(x => x.InstalledPath));
                // フォルダ名の先頭の一部がたまたま同じだった場合を考慮して、最後の \ までで切ってしまう
                var suggested = Path.GetDirectoryName(path);

                return suggested;
            }
        }