private void ExportJson(IList <Film> filmInfos) { var list = filmInfos.SelectMany(x => x.Brackets).OrderBy(x => x.Type).ThenByDescending(x => x.Text); var result = new Dictionary <string, Bracket>(); foreach (var item in list) { if (!result.ContainsKey(item.Text)) { result.Add(item.Text, item); } } BusinessFunc.ExportListToFile(result.Values, BaseConstants.BracketPath, false); }
public void ClassifyAndExportDefines(IList <Film> filmInfos, ClassificationDefine classificationDefine) { var list = new List <Phrases>(); foreach (var item in filmInfos) { var name = item.FileName; if (!string.IsNullOrEmpty(item.Distributor)) { name = name.Replace(item.Distributor, string.Empty); } if (!string.IsNullOrEmpty(item.Identification)) { name = name.Replace(item.Identification, string.Empty); } var allPhrases = name.Split(' '); foreach (var phrase in allPhrases) { if (list.Any(x => x.Phrase.Equals(phrase, StringComparison.CurrentCultureIgnoreCase))) { continue; } var type = PhraseType.Undefined; if (classificationDefine.Actors.Contains(phrase)) { type = PhraseType.Actress; } else if (classificationDefine.Genres.Contains(phrase)) { type = PhraseType.Subject; } list.Add(new Phrases { Phrase = phrase, PhraseType = type }); } } var result = list.OrderBy(x => x.PhraseType).ThenBy(x => x.Phrase); BusinessFunc.ExportListToFile(result, BaseConstants.PhrasePath, false); }
private void ReDefine() { var src = new List <DistributorCat>(); BaseConstants.LoadInfos(BaseConstants.DistributorCatPath, src); var dest = new List <DistributorCat>(); foreach (var item in src) { if (!dest.Any(x => x.Equals(item))) { dest.Add(item); } } if (!src.Any(x => dest.Any(y => x.Equals(y)))) { BusinessFunc.ExportListToFile(dest, BaseConstants.DistributorCatPath, false); } }
public void ExportJson() { BusinessFunc.ExportListToFile(DistributorCats, BaseConstants.DistributorCatPath, true); BusinessFunc.ExportListToFile(FilmInfos, BaseConstants.FilmPath, ExportAndIncludeSource); BusinessFunc.ExportListToFile(EmptyFileDirs, BaseConstants.EmptyDirPath, ExportAndIncludeSource); }
public void SaveItemsToJson(bool isIncludeSource = false) { BusinessFunc.ExportListToFile(Items, _FilePath, isIncludeSource); }