Exemplo n.º 1
0
 private void UpdateProperties()
 {
     if (_source != null)
     {
         _source.GetAllProperties(_sourceProperties);
         _properties.CopyFrom(_sourceProperties);
     }
     else
     {
         _properties.SetValue(Core.Properties.PercentageProcessed, Percentage.HundredPercent);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Initializes this object.
        /// </summary>
        /// <param name="taskScheduler"></param>
        /// <param name="maximumWaitTime"></param>
        /// <param name="maxEntryCount"></param>
        public LogSourceProxy(ITaskScheduler taskScheduler, TimeSpan maximumWaitTime, int maxEntryCount = DefaultMaxEntryCount)
        {
            if (taskScheduler == null)
            {
                throw new ArgumentNullException(nameof(taskScheduler));
            }

            _taskScheduler = taskScheduler;
            _properties    = new ConcurrentPropertiesList(Core.Properties.Minimum);
            _properties.SetValue(Core.Properties.EmptyReason, null);

            _sourceProperties = new PropertiesBufferList();
            _pendingSections  = new ConcurrentQueue <KeyValuePair <ILogSource, LogSourceModification> >();
            _listeners        = new LogSourceListenerCollection(this);

            _task            = _taskScheduler.StartPeriodic(RunOnce, "Log File Proxy");
            _maximumWaitTime = maximumWaitTime;
            _maxEntryCount   = maxEntryCount;
        }
Exemplo n.º 3
0
        /// <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();
        }
Exemplo n.º 4
0
 public override void SetProperty(IPropertyDescriptor property, object value)
 {
     _properties.SetValue(property, value);
 }