Compare commits
No commits in common. "master" and "v1.2" have entirely different histories.
@ -3,26 +3,27 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Influx.AllaganTools;
|
||||
|
||||
internal sealed class FilterResult
|
||||
{
|
||||
private readonly IEnumerable _searchResultList;
|
||||
private readonly object _delegate;
|
||||
private readonly PropertyInfo _sortedItems;
|
||||
|
||||
public FilterResult(IEnumerable searchResultList)
|
||||
public FilterResult(object @delegate)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(searchResultList);
|
||||
_searchResultList = searchResultList;
|
||||
ArgumentNullException.ThrowIfNull(@delegate);
|
||||
_delegate = @delegate;
|
||||
_sortedItems =
|
||||
_delegate.GetType().GetProperty("SortedItems") ?? throw new MissingMemberException();
|
||||
}
|
||||
|
||||
public IReadOnlyList<SortingResult> GenerateFilteredList()
|
||||
{
|
||||
return _searchResultList
|
||||
return ((IEnumerable)_sortedItems.GetValue(_delegate)!)
|
||||
.Cast<object>()
|
||||
.Select(x => x.GetType()
|
||||
.GetField("_sortingResult", BindingFlags.Instance | BindingFlags.NonPublic)!
|
||||
.GetValue(x)!)
|
||||
.Select(x => new SortingResult(x))
|
||||
.ToList();
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Influx.AllaganTools;
|
||||
@ -24,6 +23,6 @@ internal sealed class ListService : IListService
|
||||
public FilterResult? GetFilterByKeyOrName(string keyOrName)
|
||||
{
|
||||
var f = _getListByKeyOrName.Invoke(_listService, [keyOrName]);
|
||||
return f != null ? new FilterResult((IEnumerable)_refreshList.Invoke(_listFilterService, [f])!) : null;
|
||||
return f != null ? new FilterResult(_refreshList.Invoke(_listFilterService, [f])!) : null;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Dalamud.NET.Sdk/10.0.0">
|
||||
<PropertyGroup>
|
||||
<Version>1.3</Version>
|
||||
<Version>1.2</Version>
|
||||
<OutputPath>dist</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user