public static void OnPostprocessAllAssets(
            string[] importedAssets,
            string[] deletedAssets,
            string[] movedAssets,
            string[] movedFromAssetPaths)
        {
            MacrosSystem.Clear();

            //var macrosRefreshed = false;

            var output   = string.Empty;
            var defCount = 0;

            foreach (var file in importedAssets)
            {
                if (MacrosSystem.IsFileMacrosDefinition(file) == true)
                {
                    MacrosSystem.ProcessMacrosDefinition(file);
                    output += "Processing definition: " + file + "\n";
                    ++defCount;
                }

                //if (importedAssets.Contains(file) == true) macrosRefreshed = true;

                                #if SEARCH_SOURCES_IN_TEXT
                if (MacrosSystem.IsFileMacrosDefinition(file, true) == true)
                {
                    MacrosSystem.ProcessMacrosDefinition(file);
                    output += "Processing definition: " + file + "\n";
                    ++defCount;
                }

                //if (importedAssets.Contains(file) == true) macrosRefreshed = true;
                                #endif
            }

            if (defCount > 0)
            {
                Debug.Log("[MACROS] Definitions processed: " + defCount.ToString() + "\n" + output);
            }

            output = string.Empty;
            var pCount = 0;

            foreach (var file in importedAssets)
            {
                if (MacrosSystem.IsFileContainsMacros(file) == true)
                {
                    MacrosSystem.Process(file);
                    output += "Processing: " + file + "\n";
                    ++pCount;
                }
            }

            if (pCount > 0)
            {
                Debug.Log("[MACROS] Processed: " + pCount.ToString() + "\n" + output);
            }
        }
Пример #2
0
        public static void OnPostprocessAllAssets(
            string[] importedAssets,
            string[] deletedAssets,
            string[] movedAssets,
            string[] movedFromAssetPaths)
        {
            MacrosSystem.Clear();

            var macrosRefreshed = false;

            var files = AssetDatabase.FindAssets("t:MonoScript");

            foreach (var guid in files)
            {
                var file = AssetDatabase.GUIDToAssetPath(guid);
                if (MacrosSystem.IsFileMacrosDefinition(file) == true)
                {
                    MacrosSystem.ProcessMacrosDefinition(file);
                }

                if (importedAssets.Contains(file) == true)
                {
                    macrosRefreshed = true;
                }
            }

                        #if SEARCH_SOURCES_IN_TEXT
            files = AssetDatabase.FindAssets("t:Object");
            foreach (var guid in files)
            {
                var file = AssetDatabase.GUIDToAssetPath(guid);
                if (MacrosSystem.IsFileMacrosDefinition(file, true) == true)
                {
                    MacrosSystem.ProcessMacrosDefinition(file);
                }

                if (importedAssets.Contains(file) == true)
                {
                    macrosRefreshed = true;
                }
            }
                        #endif

            if (macrosRefreshed == true)
            {
                files = AssetDatabase.FindAssets("t:MonoScript");
                foreach (var guid in files)
                {
                    var file = AssetDatabase.GUIDToAssetPath(guid);
                    if (MacrosSystem.IsFileContainsMacros(file) == true)
                    {
                        MacrosSystem.Process(file);
                    }
                }
            }
            else
            {
                foreach (var file in importedAssets)
                {
                    if (MacrosSystem.IsFileContainsMacros(file) == true)
                    {
                        MacrosSystem.Process(file);
                    }
                }
            }
        }
        public static void ProcessFiles(string[] importedAssets)
        {
            MacrosSystem.Clear();

            //var macrosRefreshed = false;

            var output   = string.Empty;
            var defCount = 0;

            foreach (var file in importedAssets)
            {
                if (MacrosSystem.IsFileMacrosDefinition(file) == true)
                {
                    MacrosSystem.ProcessMacrosDefinition(file);
                    output += "Processing definition: " + file + "\n";
                    ++defCount;
                }

                //if (importedAssets.Contains(file) == true) macrosRefreshed = true;

                                #if SEARCH_SOURCES_IN_TEXT
                if (MacrosSystem.IsFileMacrosDefinition(file, true) == true)
                {
                    MacrosSystem.ProcessMacrosDefinition(file);
                    output += "Processing definition: " + file + "\n";
                    ++defCount;
                }

                //if (importedAssets.Contains(file) == true) macrosRefreshed = true;
                                #endif
            }

            if (defCount > 0)
            {
                if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                {
                    UnityEngine.Debug.Log("[MACROS] Definitions processed: " + defCount.ToString() + "\n" + output);
                }
            }

            output = string.Empty;
            var pCount = 0;

            foreach (var file in importedAssets)
            {
                if (MacrosSystem.IsFileContainsMacros(file) == true)
                {
                    MacrosSystem.Process(file);
                    output += "Processing: " + file + "\n";
                    ++pCount;
                }
            }

            if (pCount > 0)
            {
                if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                {
                    UnityEngine.Debug.Log("[MACROS] Processed: " + pCount.ToString() + "\n" + output);
                }
            }
        }