public MetaInformation(String Path) { this.Path = Path; var metaFileName = Path + "\\" + ".meta"; if (System.IO.File.Exists(metaFileName)) { Data = Newtonsoft.Json.JsonConvert.DeserializeObject <DirectoryMetaInformation>( System.IO.File.ReadAllText(metaFileName)); } else { Data = new DirectoryMetaInformation(); } }
public void UpdateFromDisc() { Data = new DirectoryMetaInformation(); foreach (var directory in Model.EnumerateDirectories(Path)) { Data.TotalWordCount += (new MetaInformation(directory)).Data.TotalWordCount; } foreach (var file in Model.EnumerateFiles(Path)) { Data.Files.Add(file, new FileMetaInformation { WordCount = WordParser.CountWords(System.IO.File.ReadAllText(file)) }); } Data.TotalWordCount += Data.Files.Select(f => f.Value.WordCount).Sum(); }