private void UpdateLocalBranches(Dictionary <string, ConfigBranch> branches, NPath path, IEnumerable <ConfigBranch> configBranches, string prefix) { foreach (var file in path.Files()) { var branchName = prefix + file.FileName; var branch = configBranches.Where(x => x.Name == branchName).Select(x => x as ConfigBranch?).FirstOrDefault(); if (!branch.HasValue) { branch = new ConfigBranch(branchName); } branches.Add(branchName, branch.Value); } foreach (var dir in path.Directories()) { UpdateLocalBranches(branches, dir, configBranches, prefix + dir.FileName + "/"); } }
private void LoadBranchesFromConfig(NPath path, IEnumerable <ConfigBranch> configBranches, string prefix) { foreach (var file in path.Files()) { var branchName = prefix + file.FileName; var branch = configBranches.Where(x => x.Name == branchName).Select(x => x as ConfigBranch?).FirstOrDefault(); if (!branch.HasValue) { branch = new ConfigBranch { Name = branchName }; } branches.Add(branchName, branch.Value); } foreach (var dir in path.Directories()) { LoadBranchesFromConfig(dir, configBranches, prefix + dir.FileName + "/"); } }