public void SaveTools() { var settingsHash = AssistLibEditorSettings.GetDataNode(_editorToolsSettingsKey); tools.Values.ForEach(tool => { var toolSettings = settingsHash.GetChild(tool.GetType().ToString()); tool.Save(toolSettings); settingsHash.AddOrSet(tool.GetType().ToString(), toolSettings); }); AssistLibEditorSettings.SetDataNode(_editorToolsSettingsKey, settingsHash); }
public EditorToolsController() { var settingsHash = AssistLibEditorSettings.GetDataNode(_editorToolsSettingsKey); AppDomain.CurrentDomain.GetAssemblies().ForEach(assembly => { assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(EditorTool)) && !t.IsAbstract).ForEach(t => { if (!tools.ContainsKey(t)) { var tool = (EditorTool)Activator.CreateInstance(t); tools.Add(t, tool); tool.Init(settingsHash.GetChild(t.ToString())); } }); }); }