/// <summary>
        /// 比较路径
        /// </summary>
        /// <param name="source">源路径</param>
        /// <returns>变体路径</returns>
        public static LowerString GetVariantPath(LowerString source)
        {
            string extension = System.IO.Path.GetExtension(source.Value);
            string newSource = source.Value.Substring(0, source.Value.LastIndexOf('.')) + "_00" + extension;

            return(new LowerString(newSource));
        }
        // Draw the header line for filters
        private void DrawFilters()
        {
            var tmp = _effectiveGamePathFilter.Text;

            ImGui.SetNextItemWidth(_effectiveLeftTextLength);
            if (ImGui.InputTextWithHint("##gamePathFilter", "Filter game path...", ref tmp, 256))
            {
                _effectiveGamePathFilter = tmp;
            }

            ImGui.SameLine(_effectiveArrowLength + _effectiveLeftTextLength + 3 * ImGui.GetStyle().ItemSpacing.X);
            ImGui.SetNextItemWidth(-1);
            tmp = _effectiveFilePathFilter.Text;
            if (ImGui.InputTextWithHint("##fileFilter", "Filter file path...", ref tmp, 256))
            {
                _effectiveFilePathFilter = tmp;
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Stock string1:\nH1e3l5l7o9");
            MyString strNum = new NumString("H1e3l5l7o9");

            Console.WriteLine("Stock number string:\n{0}", strNum);
            strNum.MoveLetters();
            Console.WriteLine("Number string after moving fisrt element to the last pos:\n{0}", strNum);

            Console.WriteLine();

            Console.WriteLine("Stock string2:\nHeLlO mY fRiEnD");
            MyString strLow = new LowerString("HeLlO mY fRiEnD");

            Console.WriteLine("Stock lower string:\n{0}", strLow);
            strLow.MoveLetters();
            Console.WriteLine("Lower string after moving last element to the first pos:\n{0}", strLow);

            Console.ReadKey();
        }
    // Draw a simple clipped table containing all changed items.
    private void DrawChangedItemTab()
    {
        // Functions in here for less pollution.
        bool FilterChangedItem(KeyValuePair <string, (SingleArray <IMod>, object?)> item)
        => (_changedItemFilter.IsEmpty ||
            ChangedItemName(item.Key, item.Value.Item2)
            .Contains(_changedItemFilter.Lower, StringComparison.InvariantCultureIgnoreCase)) &&
        (_changedItemModFilter.IsEmpty || item.Value.Item1.Any(m => m.Name.Contains(_changedItemModFilter)));

        void DrawChangedItemColumn(KeyValuePair <string, (SingleArray <IMod>, object?)> item)
        {
            ImGui.TableNextColumn();
            DrawChangedItem(item.Key, item.Value.Item2, false);
            ImGui.TableNextColumn();
            if (item.Value.Item1.Count > 0)
            {
                ImGui.TextUnformatted(item.Value.Item1[0].Name);
                if (item.Value.Item1.Count > 1)
                {
                    ImGuiUtil.HoverTooltip(string.Join("\n", item.Value.Item1.Skip(1).Select(m => m.Name)));
                }
            }

            ImGui.TableNextColumn();
            if (item.Value.Item2 is Item it)
            {
                using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.ItemId.Value());
                ImGuiUtil.RightAlign($"({( ( Quad )it.ModelMain ).A})");
            }
        }

        using var tab = ImRaii.TabItem("Changed Items");
        if (!tab)
        {
            return;
        }

        // Draw filters.
        var varWidth = ImGui.GetContentRegionAvail().X
                       - 400 * ImGuiHelpers.GlobalScale
                       - ImGui.GetStyle().ItemSpacing.X;

        ImGui.SetNextItemWidth(400 * ImGuiHelpers.GlobalScale);
        LowerString.InputWithHint("##changedItemsFilter", "Filter Item...", ref _changedItemFilter, 128);
        ImGui.SameLine();
        ImGui.SetNextItemWidth(varWidth);
        LowerString.InputWithHint("##changedItemsModFilter", "Filter Mods...", ref _changedItemModFilter, 128);

        using var child = ImRaii.Child("##changedItemsChild", -Vector2.One);
        if (!child)
        {
            return;
        }

        // Draw table of changed items.
        var height = ImGui.GetTextLineHeightWithSpacing() + 2 * ImGui.GetStyle().CellPadding.Y;
        var skips  = ImGuiClip.GetNecessarySkips(height);

        using var list = ImRaii.Table("##changedItems", 3, ImGuiTableFlags.RowBg, -Vector2.One);
        if (!list)
        {
            return;
        }

        const ImGuiTableColumnFlags flags = ImGuiTableColumnFlags.NoResize | ImGuiTableColumnFlags.WidthFixed;

        ImGui.TableSetupColumn("items", flags, 400 * ImGuiHelpers.GlobalScale);
        ImGui.TableSetupColumn("mods", flags, varWidth - 100 * ImGuiHelpers.GlobalScale);
        ImGui.TableSetupColumn("id", flags, 100 * ImGuiHelpers.GlobalScale);

        var items = Penumbra.CollectionManager.Current.ChangedItems;
        var rest  = _changedItemFilter.IsEmpty && _changedItemModFilter.IsEmpty
            ? ImGuiClip.ClippedDraw(items, skips, DrawChangedItemColumn, items.Count)
            : ImGuiClip.FilteredClippedDraw(items, skips, FilterChangedItem, DrawChangedItemColumn);

        ImGuiClip.DrawEndDummy(rest, height);
    }