public void RefreshEditorAfterGameLoad(Game newGame)
{
_game = newGame;
Factory.Events.OnRefreshAllComponentsFromGame();
Factory.GUIController.GameNameUpdated();
Factory.NativeProxy.NewGameLoaded(Factory.AGSEditor.CurrentGame);
RegenerateScriptHeader(null);
foreach (ScriptAndHeader script in newGame.RootScriptFolder.AllItemsFlat)
{
AutoComplete.ConstructCache(script.Header);
}
Factory.GUIController.ProjectTree.CollapseAll();
if (_engineComms.SupportedOnCurrentSystem)
{
_engineComms.ResetWithCurrentPath();
}
if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
{
// file system watcher only works on NT
_fileWatcher = new FileSystemWatcher(newGame.DirectoryPath);
_fileWatcher.Changed += new FileSystemEventHandler(_fileWatcher_Changed);
_fileWatcher.NotifyFilter = NotifyFilters.LastWrite;
_fileWatcher.EnableRaisingEvents = true;
}
CloseLockFile();
try
{
_lockFile = File.Create(LOCK_FILE_NAME, 32, FileOptions.DeleteOnClose);
}
catch (UnauthorizedAccessException)
{
// If the whole game folder is read-only, don't worry about it
_lockFile = null;
}
}