private void ReadFile(FilePathInfo pathInfo) { FileStream fs = new FileStream(pathInfo.Path, FileMode.Open); var img = new byte[fs.Length]; fs.Read(img, 0, img.Length); fs.Close(); fs.Dispose(); dataDict[pathInfo.VfsPath] = img; }
private static void CheckDirectory(string path, string nowDir) { foreach (var file in Directory.GetFiles(path)) { FilePathInfo info = new FilePathInfo(); info.Path = file; var lastPath = file.LastIndexOf('\\'); var fileName = file.Substring(lastPath + 1); info.VfsPath = nowDir == "" ? fileName : nowDir + "." + fileName; pathList.Add(info); } foreach (var directory in Directory.GetDirectories(path)) { DirectoryInfo directoryInfo = new DirectoryInfo(directory); CheckDirectory(directory, nowDir == "" ? directoryInfo.Name : nowDir + "." + directoryInfo.Name); } }
private static void CheckDirectory(string path, string nowDir) { foreach (var file in Directory.GetFiles(path)) { FilePathInfo info= new FilePathInfo(); info.Path = file; var lastPath = file.LastIndexOf('\\'); var fileName = file.Substring(lastPath+1); info.VfsPath = nowDir == "" ? fileName : nowDir + "." + fileName; pathList.Add(info); } foreach (var directory in Directory.GetDirectories(path)) { DirectoryInfo directoryInfo = new DirectoryInfo(directory); CheckDirectory(directory, nowDir == "" ? directoryInfo.Name : nowDir + "." + directoryInfo.Name); } }