From b64c915f3a0137467c3e37da97850e3a6ec6151d Mon Sep 17 00:00:00 2001 From: Razmoth <32140579+Razmoth@users.noreply.github.com> Date: Sun, 28 Jan 2024 13:23:44 +0400 Subject: [PATCH] - [GUI] Added `ToolTip` to display. - [Core] Fix bug where some files would stuck in infinite loop. --- AssetStudio.GUI/ExportOptions.Designer.cs | 16 ++++++--- AssetStudio.GUI/ExportOptions.cs | 43 +++++++++++++++++++++++ AssetStudio.GUI/ExportOptions.resx | 7 ++-- AssetStudio/OffsetStream.cs | 4 +++ 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/AssetStudio.GUI/ExportOptions.Designer.cs b/AssetStudio.GUI/ExportOptions.Designer.cs index 90af953..61e88e6 100644 --- a/AssetStudio.GUI/ExportOptions.Designer.cs +++ b/AssetStudio.GUI/ExportOptions.Designer.cs @@ -80,8 +80,7 @@ namespace AssetStudio.GUI castToBone = new CheckBox(); exportAllNodes = new CheckBox(); eulerFilter = new CheckBox(); - exportUvsTooltip = new ToolTip(components); - keyToolTip = new ToolTip(components); + toolTip = new ToolTip(components); groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)key).BeginInit(); panel1.SuspendLayout(); @@ -175,6 +174,7 @@ namespace AssetStudio.GUI texTypeComboBox.Size = new System.Drawing.Size(106, 23); texTypeComboBox.TabIndex = 35; texTypeComboBox.SelectedIndexChanged += TexTypeComboBox_SelectedIndexChanged; + texTypeComboBox.MouseHover += TexTypeComboBox_MouseHover; // // uvTypesComboBox // @@ -208,6 +208,7 @@ namespace AssetStudio.GUI uvsComboBox.Size = new System.Drawing.Size(75, 23); uvsComboBox.TabIndex = 32; uvsComboBox.SelectedIndexChanged += uvsComboBox_SelectedIndexChanged; + uvsComboBox.MouseHover += uvsComboBox_MouseHover; // // canExportCheckBox // @@ -251,6 +252,7 @@ namespace AssetStudio.GUI typesComboBox.Size = new System.Drawing.Size(127, 23); typesComboBox.TabIndex = 28; typesComboBox.SelectedIndexChanged += TypesComboBox_SelectedIndexChanged; + typesComboBox.MouseHover += TypesComboBox_MouseHover; // // label6 // @@ -328,7 +330,7 @@ namespace AssetStudio.GUI key.Name = "key"; key.Size = new System.Drawing.Size(55, 23); key.TabIndex = 8; - keyToolTip.SetToolTip(key, "Key in hex"); + key.MouseHover += Key_MouseHover; // // encrypted // @@ -649,6 +651,11 @@ namespace AssetStudio.GUI eulerFilter.Text = "EulerFilter"; eulerFilter.UseVisualStyleBackColor = true; // + // typesToolTip + // + toolTip.UseAnimation = false; + toolTip.UseFading = false; + // // ExportOptions // AcceptButton = OKbutton; @@ -715,11 +722,9 @@ namespace AssetStudio.GUI private System.Windows.Forms.ComboBox assetGroupOptions; private System.Windows.Forms.CheckBox restoreExtensionName; private System.Windows.Forms.CheckBox openAfterExport; - private System.Windows.Forms.ToolTip exportUvsTooltip; private System.Windows.Forms.CheckBox collectAnimations; private System.Windows.Forms.CheckBox encrypted; private System.Windows.Forms.NumericUpDown key; - private System.Windows.Forms.ToolTip keyToolTip; private System.Windows.Forms.CheckBox minimalAssetMap; private System.Windows.Forms.Label label7; private Label label6; @@ -733,5 +738,6 @@ namespace AssetStudio.GUI private Label label10; private ComboBox texTypeComboBox; private TextBox texNameTextBox; + private ToolTip toolTip; } } diff --git a/AssetStudio.GUI/ExportOptions.cs b/AssetStudio.GUI/ExportOptions.cs index 87219a6..3665706 100644 --- a/AssetStudio.GUI/ExportOptions.cs +++ b/AssetStudio.GUI/ExportOptions.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text; using System.Windows.Forms; namespace AssetStudio.GUI @@ -163,6 +164,48 @@ namespace AssetStudio.GUI } } + private void TypesComboBox_MouseHover(object sender, EventArgs e) + { + var sb = new StringBuilder(); + foreach (var type in types) + { + sb.Append($"{type.Key}: {(type.Value.Item1 ? '\x2713' : '\x2717')}, {(type.Value.Item2 ? '\x2713' : '\x2717')}\n"); + } + + toolTip.ToolTipTitle = "Type options status:"; + toolTip.SetToolTip(typesComboBox, sb.ToString()); + } + + private void uvsComboBox_MouseHover(object sender, EventArgs e) + { + var sb = new StringBuilder(); + foreach (var uv in uvs) + { + sb.Append($"{uv.Key}: {uvTypesComboBox.Items[uv.Value.Item2]}, {(uv.Value.Item1 ? '\x2713' : '\x2717')}\n"); + } + + toolTip.ToolTipTitle = "UVs options status:"; + toolTip.SetToolTip(uvsComboBox, sb.ToString()); + } + + private void TexTypeComboBox_MouseHover(object sender, EventArgs e) + { + var sb = new StringBuilder(); + foreach (var tex in texs) + { + sb.Append($"{texTypeComboBox.Items[tex.Key]}: {tex.Value}\n"); + } + + toolTip.ToolTipTitle = "Texture options status:"; + toolTip.SetToolTip(texTypeComboBox, sb.ToString()); + } + + private void Key_MouseHover(object sender, EventArgs e) + { + toolTip.ToolTipTitle = "Value"; + toolTip.SetToolTip(key, "Key in Hex"); + } + private void Cancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; diff --git a/AssetStudio.GUI/ExportOptions.resx b/AssetStudio.GUI/ExportOptions.resx index dec925d..89e9704 100644 --- a/AssetStudio.GUI/ExportOptions.resx +++ b/AssetStudio.GUI/ExportOptions.resx @@ -117,11 +117,14 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + 162, 17 - - 17, 17 + + 272, 17 57 diff --git a/AssetStudio/OffsetStream.cs b/AssetStudio/OffsetStream.cs index 46315e7..0205bfd 100644 --- a/AssetStudio/OffsetStream.cs +++ b/AssetStudio/OffsetStream.cs @@ -85,6 +85,10 @@ namespace AssetStudio { Offset = AbsolutePosition; yield return AbsolutePosition; + if (Offset == AbsolutePosition) + { + break; + } } } }