Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using SyntaxTree.VisualStudio.Unity.Bridge;
- using System;
- using System.Linq;
- using System.Xml.Linq;
- using UnityEditor;
- namespace VSTUHook
- {
- [InitializeOnLoad]
- public static class VSTUHook
- {
- static VSTUHook()
- {
- ProjectFilesGenerator.ProjectFileGeneration += Hook;
- }
- static string Hook(string filename, string content)
- {
- var document = XDocument.Parse(content);
- var metas = document.Root
- .Descendants()
- .Where(x => x.Name.LocalName == "Compile" || x.Name.LocalName == "None")
- .Select(x =>
- {
- var y = new XElement(x.Name.Namespace + "None");
- y.SetAttributeValue("Include", (string)x.Attribute("Include") + ".meta");
- return y;
- })
- .ToArray();
- document.Root
- .Descendants()
- .Last(x => x.Name.LocalName == "None")
- .AddAfterSelf(metas);
- return document.Declaration + Environment.NewLine + document.Root;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement