public void Repair(List <string> optionalPackages = null, bool force = false) { // Implicit --force when packages are specified explicitly force = force || optionalPackages?.Count > 0; foreach (var dir in EnumerateDirectories(optionalPackages)) { var path = dir.FullName; try { // Skip locally built packages (taken care of by LibraryBuilder) if (PackageFile.Exists(path) && !File.Exists(Path.Combine(path, ".unobuild")) && Repair(PackageFile.Load(path), force)) { Log.Message("Updated " + path.Relative().Quote()); } } catch (Exception e) { Log.Trace(e); Log.Error("Failed to load package " + path.Relative().Quote() + ": " + e.Message); } } }
public PackageFile Install(string name, string version = null) { if (!Force) { var upk = GetInstalled(name, version); if (upk != null) { try { var file = PackageFile.Load(upk.Source); CheckInstalled(file); return(file); } catch (Exception e) { Log.Trace(e); } } } var cached = Path.Combine(CacheDir, name + "." + version + ".nupkg"); if (File.Exists(cached)) { try { return(Install(new UpkFile(cached, name, version))); } catch (Exception e) { Log.Trace(e); } } return(Install(FindPackage(name, version))); }