Exemple #1
0
 /// <summary>
 /// Gets a list of all available add-ins in a repository
 /// </summary>
 /// <param name="repositoryUrl">
 /// A repository URL
 /// </param>
 /// <param name='flags'>
 /// Search flags.
 /// </param>
 /// <returns>
 /// A list of add-ins
 /// </returns>
 /// <remarks>
 /// This method uses cached
 /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories
 /// before using this method to ensure that the latest information is available.
 /// </remarks>
 public AddinRepositoryEntry[] GetAvailableAddins(string repositoryUrl, RepositorySearchFlags flags)
 {
     return(GetAvailableAddin(repositoryUrl, null, null, false, flags));
 }
Exemple #2
0
        PackageRepositoryEntry[] GetAvailableAddin(string repositoryUrl, string id, string version, bool updates, RepositorySearchFlags flags)
        {
            List <PackageRepositoryEntry> list = new List <PackageRepositoryEntry> ();

            IEnumerable ee;

            if (repositoryUrl != null)
            {
                ArrayList repos = new ArrayList();
                GetRepositoryTree(repositoryUrl, repos);
                ee = repos;
            }
            else
            {
                ee = service.Configuration.Repositories;
            }

            foreach (RepositoryRecord rr in ee)
            {
                if (!rr.Enabled)
                {
                    continue;
                }
                Repository rep = rr.GetCachedRepository();
                if (rep == null)
                {
                    continue;
                }
                foreach (PackageRepositoryEntry addin in rep.Addins)
                {
                    if ((id == null || Addin.GetIdName(addin.Addin.Id) == id) && (version == null || addin.Addin.Version == version))
                    {
                        if (updates)
                        {
                            Addin ainfo = service.Registry.GetAddin(Addin.GetIdName(addin.Addin.Id));
                            if (ainfo == null || Addin.CompareVersions(ainfo.Version, addin.Addin.Version) <= 0)
                            {
                                continue;
                            }
                        }
                        list.Add(addin);
                    }
                }
            }

            if ((flags & RepositorySearchFlags.LatestVersionsOnly) != 0)
            {
                FilterOldVersions(list);
            }

            // Old versions are returned first
            list.Sort();
            return(list.ToArray());
        }
Exemple #3
0
 /// <summary>
 /// Gets a list of available add-in updates.
 /// </summary>
 /// <param name="flags">
 /// Search flags
 /// </param>
 /// <returns>
 /// A list of add-in references.
 /// </returns>
 /// <remarks>
 /// The list is generated by looking at the add-ins currently installed and checking if there is any
 /// add-in with a newer version number in any of the subscribed repositories. This method uses cached
 /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories
 /// before using this method to ensure that the latest information is available.
 /// </remarks>
 public AddinRepositoryEntry[] GetAvailableUpdates(RepositorySearchFlags flags)
 {
     return(GetAvailableAddin(null, null, null, true, flags));
 }
Exemple #4
0
 /// <summary>
 /// Gets a list of available updates for an add-in in a specific repository
 /// </summary>
 /// <param name="repositoryUrl">
 /// Identifier of the add-in.
 /// </param>
 /// <param name="id">
 /// Identifier of the add-in.
 /// </param>
 /// <param name='flags'>
 /// Search flags.
 /// </param>
 /// <returns>
 /// List of updates for the specified add-in.
 /// </returns>
 /// <remarks>
 /// The list is generated by checking if there is any
 /// add-in with a newer version number in the provided repository. This method uses cached
 /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories
 /// before using this method to ensure that the latest information is available.
 /// </remarks>
 public AddinRepositoryEntry[] GetAvailableAddinUpdates(string repositoryUrl, string id, RepositorySearchFlags flags)
 {
     return(GetAvailableAddin(repositoryUrl, id, null, true, flags));
 }
		PackageRepositoryEntry[] GetAvailableAddin (string repositoryUrl, string id, string version, bool updates, RepositorySearchFlags flags)
		{
			List<PackageRepositoryEntry> list = new List<PackageRepositoryEntry> ();
			
			IEnumerable ee;
			if (repositoryUrl != null) {
				ArrayList repos = new ArrayList ();
				GetRepositoryTree (repositoryUrl, repos);
				ee = repos;
			} else
				ee = service.Configuration.Repositories;
			
			foreach (RepositoryRecord rr in ee) {
				if (!rr.Enabled)
					continue;
				Repository rep = rr.GetCachedRepository();
				if (rep == null) continue;
				foreach (PackageRepositoryEntry addin in rep.Addins) {
					if ((id == null || Addin.GetIdName (addin.Addin.Id) == id) && (version == null || addin.Addin.Version == version)) {
						if (updates) {
							Addin ainfo = service.Registry.GetAddin (Addin.GetIdName (addin.Addin.Id));
							if (ainfo == null || Addin.CompareVersions (ainfo.Version, addin.Addin.Version) <= 0)
								continue;
						}
						list.Add (addin);
					}
				}
			}
			
			if ((flags & RepositorySearchFlags.LatestVersionsOnly) != 0)
				FilterOldVersions (list);
			
			// Old versions are returned first
			list.Sort ();
			return list.ToArray ();
		}
		/// <summary>
		/// Gets a list of all available add-ins in a repository
		/// </summary>
		/// <param name="repositoryUrl">
		/// A repository URL
		/// </param>
		/// <param name='flags'>
		/// Search flags.
		/// </param>
		/// <returns>
		/// A list of add-ins
		/// </returns>
		/// <remarks>
		/// This method uses cached
		/// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories
		/// before using this method to ensure that the latest information is available.
		/// </remarks>
		public AddinRepositoryEntry[] GetAvailableAddins (string repositoryUrl, RepositorySearchFlags flags)
		{
			return GetAvailableAddin (repositoryUrl, null, null, false, flags);
		}
		/// <summary>
		/// Gets a list of all available add-ins
		/// </summary>
		/// <returns>
		/// The available addins.
		/// </returns>
		/// <param name='flags'>
		/// Search flags.
		/// </param>
		/// <remarks>
		/// This method uses cached
		/// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories
		/// before using this method to ensure that the latest information is available.
		/// </remarks>
		public AddinRepositoryEntry[] GetAvailableAddins (RepositorySearchFlags flags)
		{
			return GetAvailableAddin (null, null, null, false, flags);
		}
		/// <summary>
		/// Gets a list of available updates for an add-in in a specific repository
		/// </summary>
		/// <param name="repositoryUrl">
		/// Identifier of the add-in.
		/// </param>
		/// <param name="id">
		/// Identifier of the add-in.
		/// </param>
		/// <param name='flags'>
		/// Search flags.
		/// </param>
		/// <returns>
		/// List of updates for the specified add-in.
		/// </returns>
		/// <remarks>
		/// The list is generated by checking if there is any
		/// add-in with a newer version number in the provided repository. This method uses cached
		/// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories
		/// before using this method to ensure that the latest information is available.
		/// </remarks>
		public AddinRepositoryEntry[] GetAvailableAddinUpdates (string repositoryUrl, string id, RepositorySearchFlags flags)
		{
			return GetAvailableAddin (repositoryUrl, id, null, true, flags);
		}
		/// <summary>
		/// Gets a list of available add-in updates.
		/// </summary>
		/// <param name="flags">
		/// Search flags
		/// </param>
		/// <returns>
		/// A list of add-in references.
		/// </returns>
		/// <remarks>
		/// The list is generated by looking at the add-ins currently installed and checking if there is any
		/// add-in with a newer version number in any of the subscribed repositories. This method uses cached
		/// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories
		/// before using this method to ensure that the latest information is available.
		/// </remarks>
		public AddinRepositoryEntry[] GetAvailableUpdates (RepositorySearchFlags flags)
		{
			return GetAvailableAddin (null, null, null, true, flags);
		}