private void OnPackageInstalled(IVsPackageMetadata metadata) { // Fire and forget. When new package is installed, we are not just adding this package to the index, // but instead we attempt full sync. Full sync in this case would only sync new packages that don't // exist in the index which should be fast. The reason for full sync is that when there are several // instances of VS and each tries to update index at the same tiime, only one would succeed, other // would notive that index is locked and skip this operation. Thus if all VS instances attempt full // sync at least one of them would do it and add all new packages to the index. var indexFactory = new PackageIndexFactory(); var builder = indexFactory.GetLocalIndexBuilder(); builder.BuildAsync(newOnly: true); }
private ILocalPackageIndexBuilder GetBuilder(Arguments arguments) { var logLevel = LogLevel.Information; if (arguments.Quiet) { logLevel = LogLevel.Quiet; } else if (arguments.Verbose) { logLevel = LogLevel.Verbose; } var logFactory = new LogFactory(logLevel); logFactory.AddProvider(new ConsoleLogger()); var indexFactory = new PackageIndexFactory(logFactory); return indexFactory.GetLocalIndexBuilder(); }
public void Synchronize() { try { // Fire and forget. When new package is installed, we are not just adding this package to the index, // but instead we attempt full sync. Full sync in this case would only sync new packages that don't // exist in the index which should be fast. The reason for full sync is that when there are several // instances of VS and each tries to update index at the same tiime, only one would succeed, other // would notive that index is locked and skip this operation. Thus if all VS instances attempt full // sync at least one of them would do it and add all new packages to the index. var indexFactory = new PackageIndexFactory(); var builder = indexFactory.GetLocalIndexBuilder(); builder.BuildAsync(newOnly: builder.Index.IndexExists); } catch (Exception e) { Debug.WriteLine(e.Message); } }
private ILocalPackageIndexBuilder GetBuilder(Arguments arguments) { var logLevel = LogLevel.Information; if (arguments.Quiet) { logLevel = LogLevel.Quiet; } else if (arguments.Verbose) { logLevel = LogLevel.Verbose; } var logFactory = new LogFactory(logLevel); logFactory.AddProvider(new ConsoleLogger()); var indexFactory = new PackageIndexFactory(logFactory); return(indexFactory.GetLocalIndexBuilder()); }