private void DrawFileSwapTabEdit() { if (!ImGui.BeginTabItem(LabelFileSwapTab)) { return; } ImGui.SetNextItemWidth(-1); if (ImGui.BeginListBox(LabelFileSwapHeader, AutoFillSize)) { var swaps = Meta.FileSwaps.Keys.ToArray(); var arrow = $"{( char )FontAwesomeIcon.LongArrowAltRight}"; ImGui.PushFont(UiBuilder.IconFont); var arrowWidth = ImGui.CalcTextSize(arrow).X; ImGui.PopFont(); var width = (ImGui.GetWindowWidth() - arrowWidth - 4 * ImGui.GetStyle().ItemSpacing.X) / 2; for (var idx = 0; idx < swaps.Length + 1; ++idx) { var key = idx == swaps.Length ? GamePath.GenerateUnchecked("") : swaps[idx]; var value = idx == swaps.Length ? GamePath.GenerateUnchecked("") : Meta.FileSwaps[key]; string keyString = key; string valueString = value; ImGui.SetNextItemWidth(width); if (ImGui.InputTextWithHint($"##swapLhs_{idx}", "Enter new file to be replaced...", ref keyString, GamePath.MaxGamePathLength, ImGuiInputTextFlags.EnterReturnsTrue)) { var newKey = new GamePath(keyString); if (newKey.CompareTo(key) != 0) { if (idx < swaps.Length) { Meta.FileSwaps.Remove(key); } if (newKey != string.Empty) { Meta.FileSwaps[newKey] = value; } _selector.SaveCurrentMod(); if (Mod.Enabled) { _selector.ReloadCurrentMod(); } } } if (idx < swaps.Length) { ImGui.SameLine(); ImGui.PushFont(UiBuilder.IconFont); ImGui.TextUnformatted(arrow); ImGui.PopFont(); ImGui.SameLine(); ImGui.SetNextItemWidth(width); if (ImGui.InputTextWithHint($"##swapRhs_{idx}", "Enter new replacement path...", ref valueString, GamePath.MaxGamePathLength, ImGuiInputTextFlags.EnterReturnsTrue)) { var newValue = new GamePath(valueString); if (newValue.CompareTo(value) != 0) { Meta.FileSwaps[key] = newValue; _selector.SaveCurrentMod(); if (Mod.Enabled) { _selector.ReloadCurrentMod(); } } } } } ImGui.EndListBox(); } ImGui.EndTabItem(); }