void IEditorComponent.RefreshDataFromGame()
{
MainForm = Application.OpenForms[0];
// Copy to new list because something else may be modifying editPanes in another thread(?)
foreach (LuaScriptEditPane pane in new List<LuaScriptEditPane>(editPanes.Values))
{
editor.GUIController.RemovePaneIfExists(pane.contentDocument);
}
editPanes.Clear();
if (IsPluginEnabled)
{
scripts.Clear();
compileTimeScripts.Clear();
ClearScriptFolders();
rootScriptFolder = new LuaScriptFolderInfo(this, null, new DirectoryInfo(lscriptsdir));
rootScriptFolder.EnsureExistence();
RefreshProjectTree();
if (restoredScriptsInfo != null)
{
rootScriptFolder.UpdateFromXml(restoredScriptsInfo);
restoredScriptsInfo = null;
}
if (restoredCompileScripts != null)
{
foreach (string key in restoredCompileScripts)
{
LuaScriptFileInfo script;
if (scripts.TryGetValue(key, out script))
{
compileTimeScripts.Add(script);
}
else
{
MessageBox.Show("Cannot find script " + key + " for Compile-Time Action");
}
}
restoredCompileScripts = null;
}
RefreshCompileTimeScripts();
}
}