public static void Draw(Mod mod, Vector2 buttonSize) { ImGui.SetNextItemWidth(buttonSize.X * 2 + ImGui.GetStyle().ItemSpacing.X); var tmp = _currentModDirectory ?? mod.ModPath.Name; if (ImGui.InputText("##newModMove", ref tmp, 64)) { _currentModDirectory = tmp; _state = Mod.Manager.NewDirectoryValid(mod.ModPath.Name, _currentModDirectory, out _); } var(disabled, tt) = _state switch { Mod.Manager.NewDirectoryState.Identical => (true, "Current directory name is identical to new one."), Mod.Manager.NewDirectoryState.Empty => (true, "Please enter a new directory name first."), Mod.Manager.NewDirectoryState.NonExisting => (false, $"Move mod from {mod.ModPath.Name} to {_currentModDirectory}."), Mod.Manager.NewDirectoryState.ExistsEmpty => (false, $"Move mod from {mod.ModPath.Name} to {_currentModDirectory}."), Mod.Manager.NewDirectoryState.ExistsNonEmpty => (true, $"{_currentModDirectory} already exists and is not empty."), Mod.Manager.NewDirectoryState.ExistsAsFile => (true, $"{_currentModDirectory} exists as a file."), Mod.Manager.NewDirectoryState.ContainsInvalidSymbols => (true, $"{_currentModDirectory} contains invalid symbols for FFXIV."), _ => (true, "Unknown error."), }; ImGui.SameLine(); if (ImGuiUtil.DrawDisabledButton("Rename Mod Directory", buttonSize, tt, disabled) && _currentModDirectory != null) { Penumbra.ModManager.MoveModDirectory(mod.Index, _currentModDirectory); Reset(); } ImGui.SameLine(); ImGuiComponents.HelpMarker( "The mod directory name is used to correspond stored settings and sort orders, otherwise it has no influence on anything that is displayed.\n" + "This can currently not be used on pre-existing folders and does not support merges or overwriting."); }
public static void Reset() { _currentModDirectory = null; _state = Mod.Manager.NewDirectoryState.Identical; }