public byte[] ReadFileBytes(string path) { string fullPath = System.IO.Path.GetFullPath(path); if (File.Exists(fullPath)) { return(File.ReadBytes(fullPath)); } CryPkgPath pkgPath = GetPackagedPath(fullPath, false); if (pkgPath == null) { throw new System.IO.FileNotFoundException(path); } return(pkgPath.Package.ReadFileBytes(pkgPath.Path)); }
public bool FileExists(string path) { string fullPath = System.IO.Path.GetFullPath(path); if (File.Exists(fullPath)) { return(true); } CryPkgPath pkgPath = GetPackagedPath(fullPath, false); if (pkgPath == null) { return(false); } return(pkgPath.Package.FileExists(pkgPath.Path)); }
public bool DirectoryExists(string path) { string fullPath = System.IO.Path.GetFullPath(path); if (Directory.Exists(fullPath)) { return(true); } CryPkgPath pkgPath = GetPackagedPath(fullPath, true); if (pkgPath == null) { return(false); } return(pkgPath.Package.DirectoryExists(pkgPath.Path)); }
private string[] ListDirectoryContents(string path, bool includeFiles, bool includeDirectories) { string fullPath = System.IO.Path.GetFullPath(path); if (Directory.Exists(fullPath)) { IEnumerable <string> files = includeFiles ? Directory.ListFilesWithAbsolutePaths(fullPath) : emptyStringArray; IEnumerable <string> dirs = includeDirectories ? Directory.ListDirectoriesWithAbsolutePaths(fullPath) : emptyStringArray; return(dirs.Concat(files).ToArray()); } CryPkgPath pkgPath = GetPackagedPath(fullPath, true); if (pkgPath == null) { throw new System.IO.DirectoryNotFoundException(path); } return(pkgPath.Package.ListDirectory(pkgPath.Path, includeFiles, includeDirectories)); }