Compare commits

..

1 Commits
v1.2 ... master

Author SHA1 Message Date
0b797bd08b
Make plugin compatible with AllaganTools 1.7.1.1+ 2024-10-20 15:11:25 +02:00
3 changed files with 11 additions and 11 deletions

View File

@ -3,27 +3,26 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
namespace Influx.AllaganTools; namespace Influx.AllaganTools;
internal sealed class FilterResult internal sealed class FilterResult
{ {
private readonly object _delegate; private readonly IEnumerable _searchResultList;
private readonly PropertyInfo _sortedItems;
public FilterResult(object @delegate) public FilterResult(IEnumerable searchResultList)
{ {
ArgumentNullException.ThrowIfNull(@delegate); ArgumentNullException.ThrowIfNull(searchResultList);
_delegate = @delegate; _searchResultList = searchResultList;
_sortedItems =
_delegate.GetType().GetProperty("SortedItems") ?? throw new MissingMemberException();
} }
public IReadOnlyList<SortingResult> GenerateFilteredList() public IReadOnlyList<SortingResult> GenerateFilteredList()
{ {
return ((IEnumerable)_sortedItems.GetValue(_delegate)!) return _searchResultList
.Cast<object>() .Cast<object>()
.Select(x => x.GetType()
.GetField("_sortingResult", BindingFlags.Instance | BindingFlags.NonPublic)!
.GetValue(x)!)
.Select(x => new SortingResult(x)) .Select(x => new SortingResult(x))
.ToList(); .ToList();
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
using System.Reflection; using System.Reflection;
namespace Influx.AllaganTools; namespace Influx.AllaganTools;
@ -23,6 +24,6 @@ internal sealed class ListService : IListService
public FilterResult? GetFilterByKeyOrName(string keyOrName) public FilterResult? GetFilterByKeyOrName(string keyOrName)
{ {
var f = _getListByKeyOrName.Invoke(_listService, [keyOrName]); var f = _getListByKeyOrName.Invoke(_listService, [keyOrName]);
return f != null ? new FilterResult(_refreshList.Invoke(_listFilterService, [f])!) : null; return f != null ? new FilterResult((IEnumerable)_refreshList.Invoke(_listFilterService, [f])!) : null;
} }
} }

View File

@ -1,6 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/10.0.0"> <Project Sdk="Dalamud.NET.Sdk/10.0.0">
<PropertyGroup> <PropertyGroup>
<Version>1.2</Version> <Version>1.3</Version>
<OutputPath>dist</OutputPath> <OutputPath>dist</OutputPath>
</PropertyGroup> </PropertyGroup>