/// <summary>
        /// Read registries from XML configuration files.
        /// </summary>
        /// <returns>Dictionary of registries indexed by URL.</returns>
        private static Dictionary <string, PackageManagerRegistry> ReadRegistriesFromXml()
        {
            // Read registries from XML files.
            var xmlReader = new XmlPackageManagerRegistries();

            xmlReader.ReadAll(logger);
            return(xmlReader.Registries);
        }
        /// <summary>
        /// Called by Unity when all assets have been updated and checks to see whether any registries
        /// have changed.
        /// </summary>
        /// <param name="importedAssets">Imported assets.</param>
        /// <param name="deletedAssets">Deleted assets.</param>
        /// <param name="movedAssets">Moved assets.</param>
        /// <param name="movedFromAssetPaths">Moved from asset paths. (unused)</param>
        private static void OnPostprocessAllAssets(string[] importedAssets,
                                                   string[] deletedAssets,
                                                   string[] movedAssets,
                                                   string[] movedFromAssetPaths)
        {
            if (!Enable)
            {
                return;
            }
            bool registriesChanged = false;
            var  checkAssets       = new List <string>(importedAssets);

            checkAssets.AddRange(movedAssets);
            foreach (var asset in checkAssets)
            {
                if (XmlPackageManagerRegistries.IsRegistriesFile(asset))
                {
                    registriesChanged = true;
                    break;
                }
                AssetImporter importer = AssetImporter.GetAtPath(asset);
                if (importer != null)
                {
                    foreach (var assetLabel in AssetDatabase.GetLabels(importer))
                    {
                        if (assetLabel == XmlPackageManagerRegistries.REGISTRIES_LABEL)
                        {
                            registriesChanged = true;
                            break;
                        }
                    }
                }
            }
            if (registriesChanged)
            {
                CheckRegistries();
            }
        }