void UpdateActivePackageSource() { if (activePackageSource == null) { return; } if (activePackageSource.IsAggregate()) { if (!HasMultiplePackageSources) { ActivePackageSource = null; } } else { PackageSource matchedPackageSource = PackageSources .GetEnabledPackageSources() .FirstOrDefault(packageSource => packageSource.Equals(activePackageSource)); if (matchedPackageSource == null) { ActivePackageSource = null; } } }
public static bool IsAnySourceLocal(IVsPackageSourceProvider packageSourceProvider, out string localSource) { localSource = string.Empty; if (packageSourceProvider != null) { //If any of the active sources is local folder and is available, return true IEnumerable <PackageSource> sources = null; PackageSource activeSource = packageSourceProvider.ActivePackageSource; if (activeSource.IsAggregate()) { sources = packageSourceProvider.GetEnabledPackageSources(); foreach (PackageSource s in sources) { if (IsLocal(s.Source)) { localSource = s.Source; return(true); } } } else { if (IsLocal(activeSource.Source)) { return(true); } } } return(false); }
string GetPackageSourceName(PackageSource packageSource) { if (packageSource.IsAggregate()) { return(Catalog.GetString("All Sources")); } return(packageSource.Name); }
public static bool IsAnySourceAvailable(IVsPackageSourceProvider packageSourceProvider, bool checkHttp) { //If any of the enabled sources is http, return true if (checkHttp) { bool isHttpSource; isHttpSource = UriHelper.IsHttpSource(packageSourceProvider); if (isHttpSource) { return(true); } } if (packageSourceProvider != null) { //If any of the active sources is UNC share or local folder and is available, return true IEnumerable <PackageSource> sources = null; PackageSource activeSource = packageSourceProvider.ActivePackageSource; if (activeSource.IsAggregate()) { sources = packageSourceProvider.GetEnabledPackageSources(); foreach (PackageSource s in sources) { if (IsLocal(s.Source) || IsUNC(s.Source)) { return(true); } } } else { if (IsLocal(activeSource.Source) || IsUNC(activeSource.Source)) { return(true); } } } //If none of the above matched, return false return(false); }
string GetPackageSourceName (PackageSource packageSource) { if (packageSource.IsAggregate ()) { return Catalog.GetString ("All Sources"); } return packageSource.Name; }