// ReSharper disable once InconsistentNaming
    public static void InspectorPrefix(object __instance)
    {
        var editor = __instance as AssetImporterEditor;

        if (editor == null)
        {
            return;
        }

        var importer = editor.target as AssetImporter;

        if (importer == null)
        {
            return;
        }

        if (importer.assetPath.Contains("ImportProfiles"))
        {
            return;
        }

        List <string> assetImportersPaths =
            ImportProfiles.GetProfiles(importer.GetType()).Select(x => x.Importer.assetPath).ToList();

        GUILayout.Label(importer.userData);

        assetImportersPaths.Add("Custom");
        List <string> list = assetImportersPaths.Select(Path.GetFileNameWithoutExtension).ToList();

        string[] names = list.ToArray();

        SerializedProperty userDataProperty = editor.serializedObject.FindProperty("m_UserData");

        GUILayout.BeginHorizontal();
        int index = assetImportersPaths.IndexOf(userDataProperty.stringValue);

        if (index == -1)
        {
            index = 0;
        }

        string userDataValue;

        EditorGUI.BeginChangeCheck();
        userDataValue =
            assetImportersPaths[
                EditorGUILayout.Popup("Selected Profile", index,
                                      names)];
        if (EditorGUI.EndChangeCheck())
        {
            userDataProperty.stringValue = userDataValue;
        }

        GUILayout.EndHorizontal();

        if (userDataProperty.stringValue != "Custom")
        {
            GUI.enabled = false;
        }
    }
    private void ApplyProfile()
    {
        if (assetPath.Contains("ImportProfiles"))
        {
            return;
        }

        if (string.IsNullOrWhiteSpace(assetImporter.userData))
        {
            ProfileData defaultProfile = ImportProfiles.GetProfiles(assetImporter.GetType()).FirstOrDefault(x => Regex.IsMatch(assetImporter.assetPath, WildCardToRegular(x.WildcardQuery)));
            if (defaultProfile != null)
            {
                assetImporter.userData = defaultProfile.AssetPath;
            }
            else
            {
                return;
            }
        }

        if (assetImporter.userData == "Custom")
        {
            return;
        }

        AssetImporter importer = AssetImporter.GetAtPath(assetImporter.userData);

        if (importer == null)
        {
            return;
        }

        var so = new SerializedObject(importer);

        var targetSO = new SerializedObject(assetImporter);

        SerializedProperty property = so.GetIterator();

        property.Next(true);
        do
        {
            if (ignoredProperties.Contains(property.name))
            {
                continue;
            }

            targetSO.CopyFromSerializedProperty(property);
        } while (property.Next(false));

        targetSO.ApplyModifiedPropertiesWithoutUndo();
    }
 private void UpdateProfiles()
 {
     treeView.SetProfiles(ImportProfiles.GetProfiles());
 }