private DateTime GetLastWriteTimeUtc() { _fileInfo.Refresh(); if (!_fileInfo.Exists) { return(DateTime.MinValue); } return(FileSystemInfoHelper.GetFileLinkTargetLastWriteTimeUtc(_fileInfo) ?? _fileInfo.LastWriteTimeUtc); }
private void OnFileSystemEntryChange(string fullPath) { var fileSystemInfo = new FileInfo(fullPath); if (FileSystemInfoHelper.IsHiddenFile(fileSystemInfo)) { return; } var relativePath = fullPath.Substring(_root.Length); ReportChangeForMatchedEntries(relativePath); }
private void OnFileSystemEntryChange(string fullPath) { try { var fileSystemInfo = new FileInfo(fullPath); if (FileSystemInfoHelper.IsExcluded(fileSystemInfo, _filters)) { return; } var relativePath = fullPath.Substring(_root.Length); ReportChangeForMatchedEntries(relativePath); } catch (Exception ex) when( ex is IOException || ex is SecurityException || ex is UnauthorizedAccessException) { // Swallow the exception. } }
private DateTime GetLastWriteTimeUtc() { _fileInfo.Refresh(); if (!_fileInfo.Exists) { return(DateTime.MinValue); } DateTime?lastWriteTimeUtc = FileSystemInfoHelper.GetFileLinkTargetLastWriteTimeUtc(_fileInfo); if (lastWriteTimeUtc == null) { try { lastWriteTimeUtc = _fileInfo.LastWriteTimeUtc; } catch (IOException) { } // https://github.com/dotnet/runtime/issues/57221 } return(lastWriteTimeUtc.Value); }