private void FileCopy(iSCSI iscsi, DiscFileInfo[] FileInfos, WimFileSystem w, NtfsFileSystem ntfs) { foreach (DiscFileInfo file in FileInfos) { if (IsExcluded(file.FullName)) { log.InfoFormat("File Skip {0}", file.FullName); continue; } FileAttributes attr = file.Attributes; if ((attr & FileAttributes.ReparsePoint) == 0) { using (Stream source = w.OpenFile(file.FullName, FileMode.Open, FileAccess.Read)) { using (Stream destin = ntfs.OpenFile(file.FullName, FileMode.Create, FileAccess.Write)) { iscsi.WimCopy(source, destin, Path.GetFileName(file.FullName), false, wimFileIndex++, wimFileCount); } } if ((attr & FileAttributes.Temporary) == FileAttributes.Temporary) attr = attr & ~FileAttributes.Temporary; if ((attr & FileAttributes.Offline) == FileAttributes.Offline) attr = attr & ~FileAttributes.Offline; ntfs.SetAttributes(file.FullName, attr); } else { traceLog.InfoFormat("Reparse Point: {0}", file.FullName); ReparsePoint rp = w.GetReparsePoint(file.FullName); ntfs.SetReparsePoint(file.FullName, rp); } } }
private void FileCopy(iSCSI iscsi, DiscDirectoryInfo[] DirInfos, WimFileSystem w, NtfsFileSystem ntfs) { foreach (DiscDirectoryInfo dir in DirInfos) { if (IsExcluded(dir.FullName)) { log.InfoFormat("Directory Skip {0}", dir.FullName); continue; } FileAttributes attr = dir.Attributes; if ((dir.Attributes & FileAttributes.ReparsePoint) == 0) { ntfs.CreateDirectory(dir.FullName); if ((attr & FileAttributes.Temporary) == FileAttributes.Temporary) attr = attr & ~FileAttributes.Temporary; if ((attr & FileAttributes.Offline) == FileAttributes.Offline) attr = attr & ~FileAttributes.Offline; ntfs.SetAttributes(dir.FullName, attr); FileCopy(iscsi, dir.GetDirectories(), w, ntfs); FileCopy(iscsi, dir.GetFiles(), w, ntfs); } else { traceLog.InfoFormat("Directory ReparsePoint {0}", dir.FullName); ReparsePoint rp = w.GetReparsePoint(dir.FullName); ntfs.CreateDirectory(dir.FullName); ntfs.SetReparsePoint(dir.FullName, rp); } } }