public GlobalStatistic Read()
 {
     if (this.cache == null)
     {
         if (FileSystem.FileExists(this.fileName))
         {
             Logger.Trace("Read global statistics...");
             this.cache = JsonConvert.DeserializeObject <GlobalStatistic>(FileSystem.ReadAllText(this.fileName));
         }
         this.cache ??= new GlobalStatistic();
     }
     return(this.cache);
 }
        public void Append(Statistic statistic)
        {
            GlobalStatistic data = this.Read();

            data.AssertIsNotNull(null, "No data found. Use Read() method first");
            if (data.Today != DateTime.Today)
            {
                data.TodayFiles = 0;
                data.TodayLines = 0;
            }
            data.Today       = DateTime.Today;
            data.Files      += statistic.GeneratedFiles;
            data.Lines      += statistic.OutputLines;
            data.TodayFiles += statistic.GeneratedFiles;
            data.TodayLines += statistic.OutputLines;
            data.Ids.AddIfNotExists(statistic.Id);
        }