public static void ReloadPages()
        {
            var packages       = new List <PackageListing>();
            var webRequest     = UnityWebRequest.Get(PackageListApi);
            var asyncOpRequest = webRequest.SendWebRequest();

            asyncOpRequest.completed += (obj) =>
            {
                var response = string.Empty;

#if UNITY_2020_1_OR_NEWER
                if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
#else
                if (webRequest.isNetworkError || webRequest.isHttpError)
#endif
                { Debug.Log(webRequest.error); }
                else
                {
                    response = webRequest.downloadHandler.text;
                }

                var resultSet = JsonUtility.FromJson <PackagesResponse>($"{{ \"{nameof(PackagesResponse.results)}\": {response} }}");
                packages.AddRange(resultSet.results);
                var settings = ThunderKitSetting.GetOrCreateSettings <ThunderstoreSettings>();
                settings.LoadedPages = packages;
                EditorUtility.SetDirty(settings);
                Debug.Log($"Package listing update: {PackageListApi}");
            };
        }
    private void OnEnable()
    {
        currentlyInstalling = false;
        Task.Delay(2000).Wait();
        PackageSourceSettings settings = ThunderKitSetting.GetOrCreateSettings <PackageSourceSettings>();

        shouldClose = InstallNextPackage(settings);
    }
    private void Update()
    {
        if (currentlyInstalling || EditorApplication.isCompiling)
        {
            return;
        }

        PackageSourceSettings settings = ThunderKitSetting.GetOrCreateSettings <PackageSourceSettings>();

        shouldClose = InstallNextPackage(settings);
    }
        public static IEnumerable <PackageListing> LookupPackage(string name)
        {
            var settings = ThunderKitSetting.GetOrCreateSettings <ThunderstoreSettings>();

            if (settings == null || settings.LoadedPages == null || settings.LoadedPages.Count == 0)
            {
                return(Enumerable.Empty <PackageListing>());
            }
            else
            {
                return(settings.LoadedPages.Where(package => IsMatch(package, name)).ToArray());
            }
        }