Ejemplo n.º 1
0
 /// <summary>
 /// Checks the dependency.
 /// </summary>
 /// <param name="silent">if set to <c>true</c> [silent].</param>
 /// <returns>Return if all dependency met</returns>
 public bool CheckDependency(bool silent)
 {
   bool hasMPDependency = false;
   MpeCore.Classes.VersionProvider.MediaPortalVersion MPDependency = new Classes.VersionProvider.MediaPortalVersion();
   MpeCore.Classes.VersionProvider.SkinVersion skinDependency = new Classes.VersionProvider.SkinVersion();
   bool hasSkinDependency = false;
   foreach (DependencyItem item in Dependencies.Items)
   {
     if (!hasMPDependency && item.Type == MPDependency.DisplayName)
     {
       hasMPDependency = true;
     }
     if (item.Type == skinDependency.DisplayName)
     {
       hasSkinDependency = true;
       if (!skinDependency.Validate(item))
       {
         if (!silent)
           MessageBox.Show("Skin is not compatible with current MediaPortal version.", "Dependency error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
       }
       continue;
     }
     if (!MpeInstaller.VersionProviders[item.Type].Validate(item))
     {
       if (item.WarnOnly && item.Type != MPDependency.DisplayName)
       {
         if (!silent)
           MessageBox.Show(string.Format("{0}", item.Message), "Dependency warning", MessageBoxButtons.OK,
                           MessageBoxIcon.Warning);
       }
       else
       {
         if (!silent)
           MessageBox.Show(item.Message, "Dependency error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
       }
     }
   }
   if (!hasMPDependency)
   {
     return false;
   }
   if (IsSkin && !hasSkinDependency)
   {
     return false;
   }
   if (!CheckPluginsDependencies())
   {
     return false;
   }
   return true;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Checks if package has a MediaPortal dependency.
 /// </summary>
 /// <returns>Returns true if package has the dependency</returns>
 public bool CheckMPDependency(out DependencyItem dep)
 {
   MpeCore.Classes.VersionProvider.MediaPortalVersion MPDependency = new Classes.VersionProvider.MediaPortalVersion();
   if (CheckDependency(MPDependency, out dep))
   {
     if (dep.MaxVersion.CompareTo(MPDependency.Version(null)) > 0)
     {
       dep.MaxVersion = MPDependency.Version(null);
     }
     return true;
   }
   return false;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Checks if package has a MediaPortal dependency.
 /// </summary>
 /// <returns>Returns true if package has the dependency</returns>
 public bool CheckMPDependency(out DependencyItem dep)
 {
   MpeCore.Classes.VersionProvider.MediaPortalVersion MPDependency = new Classes.VersionProvider.MediaPortalVersion();
   if (CheckDependency(MPDependency, out dep))
   {
     if (dep.MaxVersion.CompareTo(MPDependency.Version(null)) > 0)
     {
       dep.MaxVersion = MPDependency.Version(null);
     }
     return true;
   }
   return false;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Checks the dependency.
 /// </summary>
 /// <param name="silent">if set to <c>true</c> [silent].</param>
 /// <returns>Return if all dependency met</returns>
 public bool CheckDependency(bool silent)
 {
   bool hasMPDependency = false;
   MpeCore.Classes.VersionProvider.MediaPortalVersion MPDependency = new Classes.VersionProvider.MediaPortalVersion();
   MpeCore.Classes.VersionProvider.SkinVersion skinDependency = new Classes.VersionProvider.SkinVersion();
   bool hasSkinDependency = false;
   foreach (DependencyItem item in Dependencies.Items)
   {
     if (!hasMPDependency && item.Type == MPDependency.DisplayName)
     {
       hasMPDependency = true;
     }
     if (item.Type == skinDependency.DisplayName)
     {
       hasSkinDependency = true;
       if (!skinDependency.Validate(item))
       {
         if (!silent)
           MessageBox.Show("Skin is not compatible with current MediaPortal version.", "Dependency error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
       }
       continue;
     }
     if (!MpeInstaller.VersionProviders[item.Type].Validate(item))
     {
       if (item.WarnOnly && item.Type != MPDependency.DisplayName)
       {
         if (!silent)
           MessageBox.Show(string.Format("{0}", item.Message), "Dependency warning", MessageBoxButtons.OK,
                           MessageBoxIcon.Warning);
       }
       else
       {
         if (!silent)
           MessageBox.Show(item.Message, "Dependency error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
       }
     }
   }
   if (!hasMPDependency)
   {
     return false;
   }
   if (IsSkin && !hasSkinDependency)
   {
     return false;
   }
   if (!CheckPluginsDependencies())
   {
     return false;
   }
   return true;
 }