コード例 #1
0
    protected override void DrawPopups()
    {
        _fileManager.Draw();
        DrawHelpPopup();
        DrawInfoPopup();

        if (ImGuiUtil.OpenNameField("Create New Mod", ref _newModName))
        {
            try
            {
                var newDir = Mod.CreateModFolder(Penumbra.ModManager.BasePath, _newModName);
                Mod.CreateMeta(newDir, _newModName, Penumbra.Config.DefaultModAuthor, string.Empty, "1.0", string.Empty);
                Mod.CreateDefaultFiles(newDir);
                Penumbra.ModManager.AddMod(newDir);
                _newModName = string.Empty;
            }
            catch (Exception e)
            {
                PluginLog.Error($"Could not create directory for new Mod {_newModName}:\n{e}");
            }
        }

        while (_modsToAdd.TryDequeue(out var dir))
        {
            Penumbra.ModManager.AddMod(dir);
            var mod = Penumbra.ModManager.LastOrDefault();
            if (mod != null)
            {
                MoveModToDefaultDirectory(mod);
                SelectByValue(mod);
            }
        }
    }