internal void MakeExist(FindFileData ffd, byte[] dacl) { this._fileNameLong = ffd.FileNameLong; this._fileNameShort = ffd.FileNameShort; this._fad = ffd.FileAttributesData; this._dacl = dacl; this._exists = true; }
internal FindFileData(ref UnsafeNativeMethods.WIN32_FIND_DATA wfd) { _fileAttributesData = new FileAttributesData(ref wfd); _fileNameLong = wfd.cFileName; if (wfd.cAlternateFileName != null && wfd.cAlternateFileName.Length > 0 && !StringUtil.EqualsIgnoreCase(wfd.cFileName, wfd.cAlternateFileName)) { _fileNameShort = wfd.cAlternateFileName; } }
internal static int GetFileAttributes(string path, out FileAttributesData fad) { UnsafeNativeMethods.WIN32_FILE_ATTRIBUTE_DATA win_file_attribute_data; fad = null; if (!UnsafeNativeMethods.GetFileAttributesEx(path, 0, out win_file_attribute_data)) { return(HttpException.HResultFromLastError(Marshal.GetLastWin32Error())); } fad = new FileAttributesData(ref win_file_attribute_data); return(0); }
internal FileMonitor(System.Web.DirectoryMonitor dirMon, string fileNameLong, string fileNameShort, bool exists, FileAttributesData fad, byte[] dacl) { this.DirectoryMonitor = dirMon; this._fileNameLong = fileNameLong; this._fileNameShort = fileNameShort; this._exists = exists; this._fad = fad; this._dacl = dacl; this._targets = new HybridDictionary(); this.Aliases = new HybridDictionary(true); }
static internal int GetFileAttributes(string path, out FileAttributesData fad) { fad = null; UnsafeNativeMethods.WIN32_FILE_ATTRIBUTE_DATA data; if (!UnsafeNativeMethods.GetFileAttributesEx(path, UnsafeNativeMethods.GetFileExInfoStandard, out data)) { return(HttpException.HResultFromLastError(Marshal.GetLastWin32Error())); } fad = new FileAttributesData(ref data); return(HResults.S_OK); }
static internal int GetFileAttributes(string path, out FileAttributesData fad) { fad = null; UnsafeNativeMethods.WIN32_FILE_ATTRIBUTE_DATA data; if (!UnsafeNativeMethods.GetFileAttributesEx(path, UnsafeNativeMethods.GetFileExInfoStandard, out data)) { return HttpException.HResultFromLastError(Marshal.GetLastWin32Error()); } fad = new FileAttributesData(ref data); return HResults.S_OK; }
private bool IsChangeAfterStartMonitoring(FileAttributesData fad, FileMonitorTarget target, DateTime utcCompletion) { return ((fad.UtcLastAccessTime.AddSeconds(60.0) < target.UtcStartMonitoring) || ((utcCompletion > target.UtcStartMonitoring) || ((fad.UtcLastAccessTime < fad.UtcLastWriteTime) || ((fad.UtcLastAccessTime.TimeOfDay == TimeSpan.Zero) || (fad.UtcLastAccessTime >= target.UtcStartMonitoring))))); }
internal bool GetFileAttributes(string file, out FileAttributesData fad) { FileMonitor monitor = null; fad = null; lock (this) { monitor = this.FindFileMonitor(file); if (monitor != null) { fad = monitor.Attributes; return true; } } return false; }
internal DateTime StartMonitoringPath(string alias, FileChangeEventHandler callback, out FileAttributesData fad) { FileMonitor monitor = null; DirectoryMonitor monitor2 = null; string fullPath; string file = null; bool flag = false; fad = null; if (alias == null) { throw new HttpException(System.Web.SR.GetString("Invalid_file_name_for_monitoring", new object[] { string.Empty })); } if (this.IsFCNDisabled) { fullPath = GetFullPath(alias); FindFileData data = null; if (FindFileData.FindFile(fullPath, out data) == 0) { fad = data.FileAttributesData; return data.FileAttributesData.UtcLastWriteTime; } return DateTime.MinValue; } using (new ApplicationImpersonationContext()) { this._lockDispose.AcquireReaderLock(); try { if (this._disposed) { return DateTime.MinValue; } monitor = (FileMonitor) this._aliases[alias]; if (monitor != null) { file = monitor.FileNameLong; monitor = monitor.DirectoryMonitor.StartMonitoringFileWithAssert(file, callback, alias); } else { flag = true; if ((alias.Length == 0) || !UrlPath.IsAbsolutePhysicalPath(alias)) { throw new HttpException(System.Web.SR.GetString("Invalid_file_name_for_monitoring", new object[] { HttpRuntime.GetSafePath(alias) })); } fullPath = GetFullPath(alias); if (this.IsBeneathAppPathInternal(fullPath)) { monitor2 = this._dirMonAppPathInternal; file = fullPath.Substring(this._appPathInternal.Length + 1); monitor = monitor2.StartMonitoringFileWithAssert(file, callback, alias); } else { monitor2 = this.FindDirectoryMonitor(fullPath, false, false); if (monitor2 != null) { monitor = monitor2.StartMonitoringFileWithAssert(null, callback, alias); } else { string directoryOrRootName = UrlPath.GetDirectoryOrRootName(fullPath); file = Path.GetFileName(fullPath); if (!string.IsNullOrEmpty(file)) { monitor2 = this.FindDirectoryMonitor(directoryOrRootName, false, false); if (monitor2 != null) { try { monitor = monitor2.StartMonitoringFileWithAssert(file, callback, alias); } catch { } if (monitor != null) { goto Label_01C7; } } } monitor2 = this.FindDirectoryMonitor(fullPath, true, false); if (monitor2 != null) { file = null; } else { if (string.IsNullOrEmpty(file)) { throw CreateFileMonitoringException(-2147024809, alias); } monitor2 = this.FindDirectoryMonitor(directoryOrRootName, true, true); } monitor = monitor2.StartMonitoringFileWithAssert(file, callback, alias); } } } Label_01C7: if (!monitor.IsDirectory) { monitor.DirectoryMonitor.GetFileAttributes(file, out fad); } if (flag) { this._aliases[alias] = monitor; } } finally { this._lockDispose.ReleaseReaderLock(); } if (fad != null) { return fad.UtcLastWriteTime; } return DateTime.MinValue; } }
internal void ResetCachedAttributes() { this._fad = null; this._dacl = null; }
internal void MakeExtinct() { this._fad = null; this._dacl = null; this._exists = false; }