Example #1
0
        public File(string file, TailPbl bl, int fileIndex)
        {
            if (string.IsNullOrEmpty(file))
            {
                throw new ArgumentException(@"Param cannot be empty", nameof(file));
            }
            _bl        = bl ?? throw new ArgumentNullException(nameof(bl));
            _file      = file;
            _fileIndex = fileIndex;
            _logicalLinesHistoryQueue = new LogicalLinesHistoryQueue(Math.Max(1, Configs.ContextBefore));
            _startFromNum             = Configs.LinesStartNumber;

            if (_file == Constants.CONSOLE_FILENAME)
            {
                _fileType = FileTypes.Console;
            }
            else if (ArchiveSupport.TryGetArchivePath(file, out var archive, out var finalFile) &&
                     ArchiveSupport.IsValidArchive(archive))
            {
                _fileType = string.IsNullOrWhiteSpace(finalFile)
                            ? FileTypes.Archive
                            : FileTypes.ArchivedFile;
            }

            UpdateFileInfo();
            ResetCounters();
        }
Example #2
0
 public FilesMonitorEntry(string path, TailPbl bl)
 {
     if (path == Constants.CONSOLE_FILENAME)
     {
         FileType = FileTypes.Console;
         Folder   = string.Empty;
         Mask     = Constants.CONSOLE_FILENAME;
     }
     else if (ArchiveSupport.TryGetArchivePath(path, out var archive, out var file))
     {
         FileType = FileTypes.Archive;
         Folder   = archive;
         Mask     = file;
     }