public override Int32 Open( String FileName, UInt32 CreateOptions, UInt32 GrantedAccess, out Object FileNode, out Object FileDesc0, out FileInfo FileInfo, out String NormalizedName) { FileNode = default; NormalizedName = default; if (string.IsNullOrEmpty(FileName) || FileName == "\\") { // No file path? Return some info about the root dir.. var fileDesc = new FileInstance(null, this); FileDesc0 = fileDesc; return(fileDesc.GetFileInfo(out FileInfo)); } var foundEntry = FindFile(FileName); if (foundEntry == null) { FileInfo = default; FileDesc0 = null; return(STATUS_OBJECT_NAME_NOT_FOUND); } var fileDesc2 = new FileInstance(foundEntry, this); FileDesc0 = fileDesc2; return(fileDesc2.GetFileInfo(out FileInfo)); }
public override Boolean ReadDirectoryEntry( Object FileNode, Object FileDesc0, String Pattern, String Marker, ref Object Context, out String FileName, out FileInfo FileInfo) { var Instance = (FileInstance)FileDesc0; var Enumerator = (IEnumerator <IFileEntry>)Context; if (Enumerator == null) { var childArr = RootFiles; if (Instance.FileEntry != null) { childArr = Instance.FileEntry.Children; } Enumerator = childArr.GetEnumerator(); Context = Enumerator; int Index = 0; if (null != Marker) { Index = childArr.FindIndex(s => s.Name == Marker); if (0 <= Index) { Index++; } else { Index = ~Index; } } if (Index > 0) { for (int i = 0; i < Index; i++) { Enumerator.MoveNext(); } } } if (Enumerator.MoveNext()) { var entry = Enumerator.Current; FileName = entry.Name; var desc = new FileInstance(entry, this); desc.GetFileInfo(out FileInfo); return(true); } FileName = default; FileInfo = default; return(false); }