diff --git a/Editor/Utils/ReflectionHelpers.cs b/Editor/Utils/ReflectionHelpers.cs index 8c48511..1d09f3f 100644 --- a/Editor/Utils/ReflectionHelpers.cs +++ b/Editor/Utils/ReflectionHelpers.cs @@ -49,9 +49,6 @@ static ReflectionHelpers() } else if (assembly.FullName.StartsWith("UnityEditor")) { - // HACK - if (type.Name == "CSharpNamespaceParser") continue; - _editorTypeMap[type.Name] = type; } } diff --git a/Install/FluvioFXInstall.cs b/Install/FluvioFXInstall.cs index 52632b7..d1ebb4e 100644 --- a/Install/FluvioFXInstall.cs +++ b/Install/FluvioFXInstall.cs @@ -99,13 +99,13 @@ private static void Install(bool force = false) var integrationFileExists = File.Exists($"{vfxPath}/Editor/FluvioFXIntegration.cs"); // VFXCodeGenerator.cs can't be found - var vfxCodeGenDir = $"{vfxPath}/Editor/Compiler"; - var vfxCodeGenFileName = "VFXCodeGenerator.cs"; - var vfxCodeGenPath = $"{vfxCodeGenDir}/{vfxCodeGenFileName}"; + var vfxCodeGenPath = $"{vfxPath}/Editor/Compiler/VFXCodeGenerator.cs"; string vfxCodeGenFile; try { - vfxCodeGenFile = File.ReadAllText(vfxCodeGenPath); + vfxCodeGenFile = File + .ReadAllText(vfxCodeGenPath) + .Replace("\r\n", "\n"); } catch { @@ -136,19 +136,20 @@ private static void Install(bool force = false) { // Modify VFXCodeGenerator.cs vfxCodeGenFile = vfxCodeGenFile - .Replace(codeGenEventCallReplace, codeGenEventCall) - .Replace(codeGenEventReplace, codeGenEvent) - .Replace(codeGenEventCall, codeGenEventCallReplace) - .Replace(codeGenEvent, codeGenEventReplace); + .Replace(codeGenEventCallReplace.Replace("\r\n", "\n"), codeGenEventCall.Replace("\r\n", "\n")) + .Replace(codeGenEventReplace.Replace("\r\n", "\n"), codeGenEvent.Replace("\r\n", "\n")) + .Replace(codeGenEventCall.Replace("\r\n", "\n"), codeGenEventCallReplace.Replace("\r\n", "\n")) + .Replace(codeGenEvent.Replace("\r\n", "\n"), codeGenEventReplace.Replace("\r\n", "\n")); try { - SaveFile(vfxCodeGenDir, vfxCodeGenFileName, vfxCodeGenFile); + // Save VFXCodeGenerator.cs + SaveReadOnlyFile(vfxCodeGenPath, vfxCodeGenFile); - // Add integration file + // Add FluvioFXIntegration.cs var integrationFilePath = $"{vfxPath}/Editor/FluvioFXIntegration.cs"; - File.WriteAllText(integrationFilePath, integrationFile); - File.WriteAllText($"{integrationFilePath}.meta", integrationFileMeta); + SaveReadOnlyFile(integrationFilePath, integrationFile); + SaveReadOnlyFile($"{integrationFilePath}.meta", integrationFileMeta); Debug.Log("FluvioFX install successful!"); @@ -207,12 +208,13 @@ private static void SetDefine(bool add) } } - private static void SaveFile(string directoryName, string filename, string text) + private static void SaveReadOnlyFile(string path, string text) { - var path = Path.Combine(directoryName, filename); + path = path.Replace("\\", "/"); File.SetAttributes(path, FileAttributes.Normal); File.WriteAllText(path, text); + File.SetAttributes(path, FileAttributes.ReadOnly); } } } diff --git a/Install/ReflectionHelpers.cs b/Install/ReflectionHelpers.cs index fc34952..1a3a75f 100644 --- a/Install/ReflectionHelpers.cs +++ b/Install/ReflectionHelpers.cs @@ -49,9 +49,6 @@ static ReflectionHelpers() } else if (assembly.FullName.StartsWith("UnityEditor")) { - // HACK - if (type.Name == "CSharpNamespaceParser") continue; - _editorTypeMap[type.Name] = type; } }