Example #1
0
        private void Implement(BuildReport report)
        {
            var programStatus = ProgramStatus.Instance;
            var targetNames   = programStatus.Enables.Zip(programStatus.OutputPaths, (enable, outputPath) => (enable, Path.GetFileName(outputPath))).ToArray();
            var assemblyPaths = report.files.Where(buildFile =>
            {
                if (buildFile.role != "ManagedLibrary")
                {
                    return(false);
                }
                if (string.IsNullOrWhiteSpace(buildFile.path))
                {
                    return(false);
                }
                var buildName = Path.GetFileName(buildFile.path);
                return(targetNames.All(pair => pair.Item2 != buildName) || targetNames.First(pair => pair.Item2 == buildName).Item1);
            }).Select(buildFile => buildFile.path);
            var directoryName = Path.GetDirectoryName(report.files[0].path);

            Debug.Log(directoryName);
            using (var extender = new EnumExtender(new[] { directoryName }))
            {
                extender.Extend(assemblyPaths);
            }
        }
Example #2
0
        private static void PostCompiled()
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }
            var programStatus = ProgramStatus.Instance;

            if (!EditorPrefs.HasKey(nameof(UniEnumExtension) + nameof(ProgramStatus) + "IsFirst"))
            {
                EditorPrefs.SetBool(nameof(UniEnumExtension) + nameof(ProgramStatus) + "IsFirst", true);
                return;
            }
            var assemblyPaths = programStatus.OutputPaths.Where((_, index) => programStatus.Enables[index]);

            using (var extender = new EnumExtender(searchDirectory: new[] { Path.GetDirectoryName(UnityEditorInternal.InternalEditorUtility.GetEngineCoreModuleAssemblyPath()) }))
            {
                extender.Extend(assemblyPaths);
            }
        }