Skip to content

Commit

Permalink
MP1-5181: MPE: Change platform compatibility filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
epbk committed Nov 9, 2023
1 parent 131330f commit ad1341b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 6 additions & 2 deletions mediaportal/MPE/MpeCore/Classes/ExtensionCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,26 @@ public ExtensionCollection()
/// <returns></returns>
public ExtensionCollection GetUniqueList()
{
return GetUniqueList(null);
return GetUniqueList(null, false);
}

/// <summary>
/// Gets the unique list of extensions with highest version
/// </summary>
/// <param name="exlude">Exlude these extensions</param>
/// <param name="bPlatformCompatibleOnly">Check for platform compatibility</param>
/// <returns></returns>
public ExtensionCollection GetUniqueList(ExtensionCollection exlude)
public ExtensionCollection GetUniqueList(ExtensionCollection exlude, bool bPlatformCompatibleOnly)
{
HashSet<string> exludedIds = new HashSet<string>();
if (exlude != null) exlude.Items.ForEach(p => exludedIds.Add(p.GeneralInfo.Id));
Dictionary<string, PackageClass> ids = new Dictionary<string, PackageClass>();

foreach (PackageClass item in Items)
{
if (bPlatformCompatibleOnly && !item.IsPlatformCompatible)
continue;

if (item.IsHiden || exludedIds.Contains(item.GeneralInfo.Id))
continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ExtensionListControl()

public ExtensionControlHost SelectedItem { get; set; }

public void Set(ExtensionCollection collection, bool isListOfInstalledExtensions, bool bPlatformCompatibleOnly)
public void Set(ExtensionCollection collection, bool isListOfInstalledExtensions)
{
var oldCursor = ParentForm.Cursor;
try
Expand All @@ -79,9 +79,6 @@ public void Set(ExtensionCollection collection, bool isListOfInstalledExtensions
flowLayoutPanel1.Controls.Clear();
foreach (PackageClass item in collection.Items)
{
if (bPlatformCompatibleOnly && !item.IsPlatformCompatible)
continue;

var extHostCtrl = new ExtensionControlHost();
flowLayoutPanel1.Controls.Add(extHostCtrl);
extHostCtrl.Initialize(item, isListOfInstalledExtensions);
Expand Down
4 changes: 2 additions & 2 deletions mediaportal/MPE/MpeInstaller/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ private void RefreshListControls()
extensionListControlKnown.flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
}
toolStripLastUpdate.Text = "Last update: " + (ApplicationSettings.Instance.LastUpdate == DateTime.MinValue ? "Never" : ApplicationSettings.Instance.LastUpdate.ToString("g"));
extensionListControlInstalled.Set(MpeCore.MpeInstaller.InstalledExtensions, true, false);
extensionListControlKnown.Set(MpeCore.MpeInstaller.KnownExtensions.GetUniqueList(MpeCore.MpeInstaller.InstalledExtensions), false, true);
extensionListControlInstalled.Set(MpeCore.MpeInstaller.InstalledExtensions, true);
extensionListControlKnown.Set(MpeCore.MpeInstaller.KnownExtensions.GetUniqueList(MpeCore.MpeInstaller.InstalledExtensions, true), false);
}

private void extensionListControl_UnInstallExtension(object sender, PackageClass packageClass)
Expand Down

0 comments on commit ad1341b

Please sign in to comment.