public static StripWorkDir ( FileSystemInfo workDir, FileSystemInfo file ) : string | ||
workDir | FileSystemInfo | Work directory |
file | FileSystemInfo | File whose path shall be stripp off it's workdir |
return | string |
private byte[] MakeKey(FileSystemInfo wd, FileSystemInfo f) { if (!string.IsNullOrEmpty(f.DirectoryName()) && wd.IsDirectory() && wd.Exists && !f.DirectoryName().StartsWith(wd.DirectoryName())) { throw new Exception("Path is not in working dir"); } string relName = Repository.StripWorkDir(wd, f); return(Core.Repository.GitInternalSlash(Constants.encode(relName))); }
private byte[] MakeKey(FileSystemInfo wd, FileSystemInfo f) { if (!string.IsNullOrEmpty(f.DirectoryName()) && wd.IsDirectory() && wd.Exists && !f.DirectoryName().StartsWith(wd.DirectoryName())) { throw new Exception("Path is not in working dir"); } string relName = Repository.StripWorkDir(wd, f); return(FilenameEncoding.GetBytes(relName)); }
private void ListFiles(FileSystemInfo dir, ICollection <string> list) { foreach (FileInfo f in dir.ListFiles()) { if (f.IsDirectory()) { ListFiles(f, list); } else { list.Add(Repository.StripWorkDir(_root, new FileInfo(f.FullName))); } } }
private void CheckConflictsWithFile(FileSystemInfo file) { if (file.IsDirectory()) { List <string> childFiles = ListFiles(file); Conflicts.AddRange(childFiles); } else { FileSystemInfo parent = Directory.GetParent(file.FullName); if (parent == null) { return; } while (!parent.Equals(_root)) { if (parent.IsDirectory()) { break; } if (parent.IsFile()) { Conflicts.Add(Repository.StripWorkDir(_root, parent)); break; } parent = Directory.GetParent(parent.FullName); if (parent == null) { return; } } } }