/// <summary> /// Initializes this text log file. /// </summary> /// <param name="filesystem"></param> /// <param name="taskScheduler"></param> /// <param name="fileName"></param> /// <param name="format"></param> /// <param name="encoding"></param> internal TextLogSource(IFilesystem filesystem, ITaskScheduler taskScheduler, string fileName, ILogFileFormat format, Encoding encoding) : base(taskScheduler) { _filesystem = filesystem; _fileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); _encoding = encoding ?? throw new ArgumentNullException(nameof(encoding)); _entries = new LogBufferList(Core.Columns.RawContent); _columns = new IColumnDescriptor[] { Core.Columns.Index, Core.Columns.OriginalIndex, Core.Columns.LogEntryIndex, Core.Columns.LineNumber, Core.Columns.OriginalLineNumber, Core.Columns.OriginalDataSourceName, Core.Columns.RawContent, PageBufferedLogSource.RetrievalState }; _sourceDoesNotExist = new SourceDoesNotExist(fileName); _sourceCannotBeAccessed = new SourceCannotBeAccessed(fileName); _localProperties = new PropertiesBufferList(Core.Properties.Minimum); _localProperties.SetValue(Core.Properties.Name, _fileName); _localProperties.Add(TextProperties.LineCount); _localProperties.SetValue(Core.Properties.Format, format); _localProperties.SetValue(TextProperties.LineCount, 0); _localProperties.SetValue(TextProperties.RequiresBuffer, false); _properties = new ConcurrentPropertiesList(Core.Properties.Minimum); SynchronizePropertiesWithUser(); _syncRoot = new object(); _properties.SetValue(TextProperties.AutoDetectedEncoding, encoding); Log.DebugFormat("Log File '{0}' is interpreted using {1}", _fileName, _encoding.EncodingName); StartTask(); }