private void UpdateResourceList()
        {
            AddDefaultResourceNodes();

            string prj2Path = string.Empty;

            if (_ide.SelectedLevel.SpecificFile == "$(LatestFile)")
            {
                prj2Path = Path.Combine(_ide.SelectedLevel.FolderPath, _ide.SelectedLevel.GetLatestPrj2File());
            }
            else
            {
                prj2Path = Path.Combine(_ide.SelectedLevel.FolderPath, _ide.SelectedLevel.SpecificFile);
            }

            Prj2Loader.LoadedObjects levelObjects = new Prj2Loader.LoadedObjects();

            using (FileStream stream = new FileStream(prj2Path, FileMode.Open, FileAccess.Read, FileShare.Read))
                levelObjects = Prj2Loader.LoadFromPrj2OnlyObjects(prj2Path, stream);

            LevelSettings settings = levelObjects.Settings;

            AddTextureFileNodes(settings);
            AddWadFileNodes(settings);
            AddGeometryFileNodes(settings);

            label_Loading.Visible = false;
            treeView_Resources.Invalidate();
        }
        public ObjectInstance MergeGetSingleObject(Editor editor)
        {
            Prj2Loader.LoadedObjects loadedObjects    = CreateObjects();
            ObjectInstance           obj              = (ObjectInstance)loadedObjects.Objects[0];
            LevelSettings            newLevelSettings = editor.Level.Settings.Clone();

            obj.CopyDependentLevelSettings(new Room.CopyDependentLevelSettingsArgs(null, newLevelSettings, loadedObjects.Settings, true));
            editor.UpdateLevelSettings(newLevelSettings);

            // A little workaround to detect script id collisions already
            if (obj is IHasScriptID)
            {
                Room testRoom = editor.SelectedRoom;
                try
                {
                    testRoom.AddObject(editor.Level, obj);
                    testRoom.RemoveObject(editor.Level, obj);
                }
                catch (ScriptIdCollisionException)
                {
                    ((IHasScriptID)obj).ScriptId = null;
                }
            }
            return(obj);
        }