/// <summary>
    /// Called by kernel when a query for ENS owners has finished
    /// </summary>
    /// <param name="payload">query result sent by kernel</param>
    public void SetENSOwnerQueryResult(string payload)
    {
        ResultPayload result = Utils.SafeFromJson <ResultPayload>(payload);

        UserProfileModel[] profiles = null;
        if (result.success && result.profiles.Length > 0)
        {
            profiles = result.profiles;
        }
        OnSearchResult?.Invoke(result.searchInput, profiles);
    }
Exemple #2
0
        internal void Search(string filterTxt, Version gameversion)
        {
            //this is not the efficentest way for filtering... this part is for readability optimized
            Func <ModInfo.ReleaseInfo, bool> versionCheck = (ModInfo.ReleaseInfo releaseInfo) => true;

            if (gameversion != null)
            {
                versionCheck = (ModInfo.ReleaseInfo releaseInfo) =>
                {
                    Version modVersion = releaseInfo.GetComparableGameVersion();
                    if (modVersion != null)
                    {
                        return(modVersion.Major == gameversion.Major && modVersion.Minor == gameversion.Minor);
                    }
                    //here's a problem: the mod info doesn't contain any version... we assume it's not up-to-date and so not compatible
                    //TODO: check if negating makes sense
                    return(false);
                }
            }
            ;

            List <ModInfo> searchResult = new List <ModInfo>();

            foreach (ModInfo mod in _allMods)
            {
                if (!mod.Name.ToLower().Contains(filterTxt.ToLower()))
                {
                    continue;
                }
                if (mod.Releases.Any(versionCheck))
                {
                    searchResult.Add(mod);
                }
            }

            OnSearchResult?.Invoke(searchResult);
        }