private static void SetUpEditor() { { FileInfo[] files = CurrentProject.ScriptsDirectory.GetFiles("*.cs"); CodeFilePaths = new string[files.Length]; for (var i = 0; i < files.Length; i++) { CodeFilePaths[i] = files[i].FullName; } } // Compile the code. UserAssembly = MainClass.Compile(); MainClass.Analyze(UserAssembly); var fileSystemWatcher = new FileSystemWatcher(CurrentProject.ScriptsDirectory.FullName, "*.cs"); fileSystemWatcher.Changed += (_, _1) => { Output.Log("Code change detected, recompiling."); CodeFilePaths = Directory.GetFiles(CurrentProject.ScriptsDirectory.FullName, "*.cs"); // TODO: something to wait until the file is ready. Thread.Sleep(100); MainClass.Compile(); MainClass.Analyze(UserAssembly); }; fileSystemWatcher.EnableRaisingEvents = true; RootHierarchyObject = new ImaginaryHierarchyObject(null, new ImaginaryConstructableObject(typeof(HierarchyRoot))); CurrentSelectedHierarchyObject = RootHierarchyObject; EditorWindowTypes = ScanningSystem.ScanningSystem.FindSubclasses <EditorWindow>(ScanningSystem.ScanningSystem.TypesInAssemblies((IEnumerable <Assembly>) new[] { Assembly.GetExecutingAssembly(), UserAssembly })); }