Exemplo n.º 1
0
        // This method is for pre-2018.1, and is called after the file has been written to disk
        public static void OnGeneratedCSProjectFiles()
        {
            if (UnityEditorInternal.InternalEditorUtility.inBatchMode)
            {
                return;
            }

            if (UnityUtils.UnityVersion >= new Version(2018, 1))
            {
                return;
            }

            try
            {
                ourLogger.Verbose("Post-processing {0} (old version)");
                // get only csproj files, which are mentioned in sln
                var lines            = SlnAssetPostprocessor.GetCsprojLinesInSln();
                var currentDirectory = Directory.GetCurrentDirectory();
                var projectFiles     = Directory.GetFiles(currentDirectory, "*.csproj")
                                       .Where(csprojFile => lines.Any(line => line.Contains("\"" + Path.GetFileName(csprojFile) + "\""))).ToArray();

                foreach (var file in projectFiles)
                {
                    UpgradeProjectFile(file);
                }
            }
            catch (Exception e)
            {
                // unhandled exception kills editor
                Debug.LogError(e);
            }
        }
Exemplo n.º 2
0
        // This method is for pre-2018.1, and is called after the file has been written to disk
        public static void OnGeneratedCSProjectFiles()
        {
            if (!PluginEntryPoint.Enabled || UnityUtils.UnityVersion >= new Version(2018, 1))
            {
                return;
            }

            try
            {
                // get only csproj files, which are mentioned in sln
                var lines            = SlnAssetPostprocessor.GetCsprojLinesInSln();
                var currentDirectory = Directory.GetCurrentDirectory();
                var projectFiles     = Directory.GetFiles(currentDirectory, "*.csproj")
                                       .Where(csprojFile => lines.Any(line => line.Contains("\"" + Path.GetFileName(csprojFile) + "\""))).ToArray();

                foreach (var file in projectFiles)
                {
                    UpgradeProjectFile(file);
                }
            }
            catch (Exception e)
            {
                // unhandled exception kills editor
                Debug.LogError(e);
            }
        }
        public static void OnGeneratedCSProjectFiles()
        {
            if (!PluginEntryPoint.Enabled)
            {
                return;
            }

            // get only csproj files, which are mentioned in sln
            var lines            = SlnAssetPostprocessor.GetCsprojLinesInSln();
            var currentDirectory = Directory.GetCurrentDirectory();
            var projectFiles     = Directory.GetFiles(currentDirectory, "*.csproj")
                                   .Where(csprojFile => lines.Any(line => line.Contains("\"" + Path.GetFileName(csprojFile) + "\""))).ToArray();

            foreach (var file in projectFiles)
            {
                UpgradeProjectFile(file);
            }
        }