public override bool Validate(DependencyItem dependency) { if (dependency.MinVersion < MinimumMPVersionRequired) return false; return base.Validate(dependency); }
public bool Validate(DependencyItem componentItem) { if (componentItem.MinVersion.CompareTo(MinimumMPVersionRequired) < 0) return false; if (Version(componentItem.Id).CompareTo(componentItem.MinVersion) >= 0 && Version(componentItem.Id).CompareTo(componentItem.MaxVersion) <= 0) return true; return false; }
private void testToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem menu = sender as ToolStripMenuItem; IVersionProvider type = menu.Tag as IVersionProvider; if (type != null) { var item = new DependencyItem(type.DisplayName); Package.Dependencies.Add(item); list_versions.Items.Add(item); } }
public RequirementsSection() { InitializeComponent(); SelectedItem = null; foreach (var versionProvider in MpeInstaller.VersionProviders) { ToolStripMenuItem testToolStripMenuItem = new ToolStripMenuItem(); testToolStripMenuItem.Text = versionProvider.Value.DisplayName; testToolStripMenuItem.Tag = versionProvider.Value; testToolStripMenuItem.Click += testToolStripMenuItem_Click; mnu_add.DropDownItems.Add(testToolStripMenuItem); cmb_type.Items.Add(versionProvider.Value.DisplayName); } }
private void testToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem menu = sender as ToolStripMenuItem; IVersionProvider type = menu.Tag as IVersionProvider; if (type != null) { var item = new DependencyItem(type.DisplayName) { MinVersion = type.Version(null), MaxVersion = type.Version(null) }; if (type is MpeCore.Classes.VersionProvider.MediaPortalVersion) { item.Message = string.Format("This version of {0} requires MediaPortal {1} or higher!", Package.GeneralInfo.Name, MediaPortal.Common.Utils.CompatibilityManager.MediaPortalReleaseForApiVersion(new Version(item.MinVersion.ToString()))); } Package.Dependencies.Add(item); list_versions.Items.Add(item); } }
private static DependencyItem CreateStrictDependency(MpeCore.Interfaces.IVersionProvider depType) { DependencyItem depItem = new DependencyItem(); depItem.Type = depType.DisplayName; depItem.WarnOnly = false; depItem.MinVersion = depType.Version(null); depItem.MaxVersion = depType.Version(null); depItem.Name = depType.DisplayName; return depItem; }
/// <summary> /// Checks if package has a dependency of the specified type. /// </summary> /// <param name="depType">Type of VersionProvider to check for</param> /// <param name="depItem">Specific dependency item in dpendencies collection that is of the desired type</param> /// <returns>Returns true if package has the dependency</returns> public bool CheckDependency(MpeCore.Interfaces.IVersionProvider depType, out DependencyItem depItem) { depItem = null; foreach (DependencyItem item in Dependencies.Items) { if (item.Type == depType.DisplayName) { depItem = item; return true; } } return false; }
/// <summary> /// Checks if package has a Skin dependency. /// </summary> /// <returns>Returns true if package has the dependency</returns> public bool CheckSkinDependency(out DependencyItem dep) { MpeCore.Classes.VersionProvider.SkinVersion SkinDependency = new Classes.VersionProvider.SkinVersion(); return CheckDependency(SkinDependency, out dep); }
/// <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; }
public void Add(DependencyItem item) { Items.Add(item); }
private void list_versions_SelectedIndexChanged(object sender, EventArgs e) { if (list_versions.SelectedItems.Count < 1) { groupBox1.Enabled = false; return; } groupBox1.Enabled = true; DependencyItem item = list_versions.SelectedItem as DependencyItem; SelectedItem = null; cmb_type.Text = item.Type; chk_warn.Checked = item.WarnOnly; UpdateControlStates(); txt_id.Text = item.Id; txt_name.Text = item.Name; txt_message.Text = item.Message; txt_version1_min.Text = item.MinVersion.Major; txt_version2_min.Text = item.MinVersion.Minor; txt_version3_min.Text = item.MinVersion.Build; txt_version4_min.Text = item.MinVersion.Revision; txt_version1_max.Text = item.MaxVersion.Major; txt_version2_max.Text = item.MaxVersion.Minor; txt_version3_max.Text = item.MaxVersion.Build; txt_version4_max.Text = item.MaxVersion.Revision; SelectedItem = item; if (MpeInstaller.VersionProviders.ContainsKey(cmb_type.Text)) lbl_ver.Text = MpeInstaller.VersionProviders[cmb_type.Text].Version(txt_id.Text).ToString(); }