/// <summary> /// Loads new events from a file if the file has changed. /// </summary> private void RefreshEvents(EventTable eventTable) { if (string.IsNullOrEmpty(eventTable.FileName)) { eventTable.FileName = Path.Combine(archivePath, EventTableAdapter.GetTableFileName(Code, eventTable.TableDate)); } DateTime fileAge = File.Exists(eventTable.FileName) ? File.GetLastWriteTimeUtc(eventTable.FileName) : DateTime.MinValue; if (fileAge > DateTime.MinValue && fileAge != eventTable.FileAge) { stopwatch.Restart(); adapter.FileName = eventTable.FileName; adapter.Fill(eventTable); eventTable.FileAge = fileAge; stopwatch.Stop(); arcLog?.WriteAction(Locale.IsRussian ? "Чтение таблицы событий длины {0} успешно завершено за {1} мс" : "Reading an event table of length {0} completed successfully in {1} ms", eventTable.Events.Count, stopwatch.ElapsedMilliseconds); } }