/// <summary> /// Requested file info for asset that hasn't been loaded yet. /// </summary> public HResult GetPlaceholderInfoCallback(int commandId, string path, uint triggeringProcessId, string triggeringProcessImageFileName) { var assetPath = GetAssetPath(path); PakFileSystemInfo fileInfo = GetSystemInfo(assetPath); if (fileInfo == null) { return(HResult.FileNotFound); } return(virtualizationInstance.WritePlaceholderInfo( Path.Combine(Path.GetDirectoryName(path), fileInfo.Name), DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, fileInfo.Attributes, fileInfo.Size, fileInfo is PakDirectoryInfo, null, null // Don't think these identifiers are necessary... )); }
public HResult GetDirectoryEnumerationCallback(int commandId, Guid enumerationId, string filterFileName, bool restartScan, IDirectoryEnumerationResults enumResult) { if (!enumerations.TryGetValue(enumerationId, out FileEnumeration enumeration)) { return(HResult.InternalError); } if (restartScan) { enumeration.Reset(); } if (restartScan || enumeration.Filter == null) { enumeration.Filter = filterFileName ?? ""; } enumeration.MoveNext(); bool added = false; while (enumeration.Valid) { PakFileSystemInfo fileInfo = enumeration.Current; if (enumResult.Add( fileName: string.IsNullOrWhiteSpace(fileInfo.Name) ? "REPLACEME" : fileInfo.Name, fileSize: fileInfo.Size, isDirectory: fileInfo is PakDirectoryInfo, fileAttributes: fileInfo.Attributes, creationTime: DateTime.Now, lastAccessTime: DateTime.Now, lastWriteTime: DateTime.Now, changeTime: DateTime.Now)) { added = true; enumeration.MoveNext(); } else { return(added ? HResult.Ok : HResult.InsufficientBuffer); } } return(HResult.Ok); }