public IList <IRuleModel> Find() { var result = new List <IRuleModel>(); foreach (var film in Films.Where(x => x.Brackets.Count == 0)) { var sugs = new List <string>(); var dists = DistributorCats.Where(x => film.FileName.IncludeText(x.Category)); foreach (var dist in dists) { var index = film.FileName.IndexOf(dist.Category) + dist.Category.Length - 1; if (film.FileName.Substring(index + 1, 1) != "-") { continue; } var idenNum = 0; GetIdentificationNumber(film.FileName, index, ref idenNum); var digits = Math.Floor(Math.Log10(idenNum) + 1); if (digits <= 1) { continue; } sugs.Add($"({dist.Distributor})({dist.Category + "-" + idenNum})"); } result.Add(new FilmNameSuggestion { Film = film, Suggestions = sugs }); } return(result); }
public IList <IRuleModel> Find() { var result = new List <IRuleModel>(); foreach (var film in Films.Where(x => x.Brackets.Count == 1)) { var bracket = film.Brackets[0]; if (bracket.Type != Configs.CategoryType.Identification) { continue; } var iden = bracket.Text.RemoveCharToEmptyStr("(", ")"); var sugs = new List <string>(); var dists = DistributorCats.Where(x => iden.StartsWith(x.Category)); foreach (var dist in dists) { sugs.Add($"({dist.Distributor}){bracket.Text}"); } result.Add(new FilmNameSuggestion { Film = film, Suggestions = sugs }); } return(result); }