public void SetLastWriteTimeUtc(string file, DateTime lastWriteTimeUtc) { if (!IsPathInCone(file, out string processedPath)) { _basis.SetLastWriteTimeUtc(file, lastWriteTimeUtc); } file = processedPath; string rel = file.Substring(_root.FullPath.Length).Trim('/', '\\'); string[] parts = rel.Split('/', '\\'); FileSystemDirectory currentDir = _root; for (int i = 0; i < parts.Length - 1; ++i) { FileSystemDirectory dir; if (!currentDir.Directories.TryGetValue(parts[i], out dir)) { dir = new FileSystemDirectory(parts[i], Path.Combine(currentDir.FullPath, parts[i])); currentDir.Directories[parts[i]] = dir; } currentDir = dir; } FileSystemFile targetFile; if (!currentDir.Files.TryGetValue(parts[parts.Length - 1], out targetFile)) { throw new FileNotFoundException("File not found", file); } targetFile.LastWriteTimeUtc = lastWriteTimeUtc; }