public byte[] ReadFileBytes(string pathRelativeToLibraryRoot) { string fullPath = FileUtil.JoinPath(this.Directory, pathRelativeToLibraryRoot); if (fileUtil.FileExists(fullPath)) { return(fileUtil.ReadFileBytes(fullPath)); } throw new System.InvalidOperationException("The '" + this.ID + "' library does not contain the resource '" + pathRelativeToLibraryRoot + "'"); }
private void ReadAllFiles(Dictionary <string, byte[]> output, int pathTrimLength, string dir) { foreach (string path in fileUtil.ListFiles(dir)) { string fullPath = Path.Join(dir, path); output[fullPath.Substring(pathTrimLength).Replace('\\', '/')] = fileUtil.ReadFileBytes(fullPath); } foreach (string path in fileUtil.ListDirectories(dir)) { string fullPath = Path.Join(dir, path); ReadAllFiles(output, pathTrimLength, fullPath); } }