public static string FindSolutionFile() { var currentDirectory = Environment.CurrentDirectory.ToFullPath(); var files = new FileSystem().FindFiles(currentDirectory, FileSet.Deep("*.sln")); if (files.Count() == 1) { return Path.GetFileName(files.Single()); } if (files.Any()) { ConsoleWriter.Write(ConsoleColor.Yellow, "Found more than one *.sln file:"); files.Each(x => ConsoleWriter.Write(ConsoleColor.Yellow, x)); ConsoleWriter.Write(ConsoleColor.Yellow, "You need to specify the solution with the --solution flag"); } else { ConsoleWriter.Write(ConsoleColor.Yellow, "Could not find any *.sln files"); } return null; }
public static SolutionFiles FromDirectory(string directory) { var rippleConfigs = new FileSet { Include = RippleDependencyStrategy.RippleDependenciesConfig, DeepSearch = true }; var isClassicMode = false; var configFiles = new FileSystem().FindFiles(directory, rippleConfigs); if (!configFiles.Any()) { isClassicMode = true; RippleLog.Info("Classic Mode Detected"); } var files = isClassicMode ? Classic() : Basic(); files.resetDirectories(directory); return files; }
public bool HasLockedFiles(Solution solution) { return _dependencies.Any(dependency => { var folder = dependency.NugetFolder(solution); var assemblySet = new FileSet { Include = "*.dll" }; var files = new FileSystem().FindFiles(folder, assemblySet); return files.Any(file => { try { using (var read = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.None)) { } return false; } catch { return true; } }); }); }