From a89a2d5da384913f91b8a04cc629c52150d16a70 Mon Sep 17 00:00:00 2001 From: DraToXo <93015857+DraToXo@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:17:32 +0100 Subject: [PATCH 1/8] Added replace Edited FindForm replace Numbers: - percentage - absolute - relative --- UAssetGUI/FindForm.Designer.cs | 320 +++++++++++++++++++++------------ UAssetGUI/FindForm.cs | 72 ++++++++ UAssetGUI/FindForm.resx | 54 +++--- 3 files changed, 303 insertions(+), 143 deletions(-) diff --git a/UAssetGUI/FindForm.Designer.cs b/UAssetGUI/FindForm.Designer.cs index cf3bac3..d1cf8da 100644 --- a/UAssetGUI/FindForm.Designer.cs +++ b/UAssetGUI/FindForm.Designer.cs @@ -29,158 +29,240 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.closeButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.searchForBox = new System.Windows.Forms.TextBox(); - this.nextButton = new System.Windows.Forms.Button(); - this.searchDirectionGroupBox = new System.Windows.Forms.GroupBox(); - this.searchDirBackwardButton = new System.Windows.Forms.RadioButton(); - this.searchDirForwardButton = new System.Windows.Forms.RadioButton(); - this.optionsGroupBox = new System.Windows.Forms.GroupBox(); - this.useRegexCheckBox = new System.Windows.Forms.CheckBox(); - this.caseSensitiveCheckBox = new System.Windows.Forms.CheckBox(); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.searchDirectionGroupBox.SuspendLayout(); - this.optionsGroupBox.SuspendLayout(); - this.SuspendLayout(); + closeButton = new System.Windows.Forms.Button(); + label1 = new System.Windows.Forms.Label(); + searchForBox = new System.Windows.Forms.TextBox(); + nextButton = new System.Windows.Forms.Button(); + searchDirectionGroupBox = new System.Windows.Forms.GroupBox(); + searchDirBackwardButton = new System.Windows.Forms.RadioButton(); + searchDirForwardButton = new System.Windows.Forms.RadioButton(); + optionsGroupBox = new System.Windows.Forms.GroupBox(); + useRegexCheckBox = new System.Windows.Forms.CheckBox(); + caseSensitiveCheckBox = new System.Windows.Forms.CheckBox(); + progressBar1 = new System.Windows.Forms.ProgressBar(); + buttonReplace = new System.Windows.Forms.Button(); + textBoxReplace = new System.Windows.Forms.TextBox(); + checkBoxReplace = new System.Windows.Forms.CheckBox(); + label2 = new System.Windows.Forms.Label(); + buttonReplaceAll = new System.Windows.Forms.Button(); + comboBoxReplace = new System.Windows.Forms.ComboBox(); + searchDirectionGroupBox.SuspendLayout(); + optionsGroupBox.SuspendLayout(); + SuspendLayout(); // // closeButton // - this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.closeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.closeButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); - this.closeButton.ForeColor = System.Drawing.SystemColors.ControlText; - this.closeButton.Location = new System.Drawing.Point(224, 124); - this.closeButton.Name = "closeButton"; - this.closeButton.Size = new System.Drawing.Size(75, 26); - this.closeButton.TabIndex = 6; - this.closeButton.Text = "Close"; - this.closeButton.UseVisualStyleBackColor = true; - this.closeButton.Click += new System.EventHandler(this.closeButton_Click); + closeButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + closeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + closeButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); + closeButton.ForeColor = System.Drawing.SystemColors.ControlText; + closeButton.Location = new System.Drawing.Point(467, 93); + closeButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + closeButton.Name = "closeButton"; + closeButton.Size = new System.Drawing.Size(88, 30); + closeButton.TabIndex = 6; + closeButton.Text = "Close"; + closeButton.UseVisualStyleBackColor = true; + closeButton.Click += closeButton_Click; // // label1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 19); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(59, 13); - this.label1.TabIndex = 6; - this.label1.Text = "Search for:"; + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(14, 22); + label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(63, 15); + label1.TabIndex = 6; + label1.Text = "Search for:"; // // searchForBox // - this.searchForBox.Location = new System.Drawing.Point(77, 16); - this.searchForBox.Name = "searchForBox"; - this.searchForBox.Size = new System.Drawing.Size(222, 20); - this.searchForBox.TabIndex = 0; + searchForBox.Location = new System.Drawing.Point(90, 18); + searchForBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + searchForBox.Name = "searchForBox"; + searchForBox.Size = new System.Drawing.Size(258, 23); + searchForBox.TabIndex = 0; // // nextButton // - this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.nextButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.nextButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); - this.nextButton.ForeColor = System.Drawing.SystemColors.ControlText; - this.nextButton.Location = new System.Drawing.Point(143, 124); - this.nextButton.Name = "nextButton"; - this.nextButton.Size = new System.Drawing.Size(75, 26); - this.nextButton.TabIndex = 5; - this.nextButton.Text = "Next"; - this.nextButton.UseVisualStyleBackColor = true; - this.nextButton.Click += new System.EventHandler(this.nextButton_Click); + nextButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + nextButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + nextButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); + nextButton.ForeColor = System.Drawing.SystemColors.ControlText; + nextButton.Location = new System.Drawing.Point(354, 12); + nextButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + nextButton.Name = "nextButton"; + nextButton.Size = new System.Drawing.Size(88, 30); + nextButton.TabIndex = 5; + nextButton.Text = "Next"; + nextButton.UseVisualStyleBackColor = true; + nextButton.Click += nextButton_Click; // // searchDirectionGroupBox // - this.searchDirectionGroupBox.Controls.Add(this.searchDirBackwardButton); - this.searchDirectionGroupBox.Controls.Add(this.searchDirForwardButton); - this.searchDirectionGroupBox.Location = new System.Drawing.Point(200, 42); - this.searchDirectionGroupBox.Name = "searchDirectionGroupBox"; - this.searchDirectionGroupBox.Size = new System.Drawing.Size(99, 65); - this.searchDirectionGroupBox.TabIndex = 11; - this.searchDirectionGroupBox.TabStop = false; - this.searchDirectionGroupBox.Text = "Search direction"; + searchDirectionGroupBox.Controls.Add(searchDirBackwardButton); + searchDirectionGroupBox.Controls.Add(searchDirForwardButton); + searchDirectionGroupBox.Location = new System.Drawing.Point(460, 12); + searchDirectionGroupBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + searchDirectionGroupBox.Name = "searchDirectionGroupBox"; + searchDirectionGroupBox.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); + searchDirectionGroupBox.Size = new System.Drawing.Size(115, 75); + searchDirectionGroupBox.TabIndex = 11; + searchDirectionGroupBox.TabStop = false; + searchDirectionGroupBox.Text = "Search direction"; // // searchDirBackwardButton // - this.searchDirBackwardButton.AutoSize = true; - this.searchDirBackwardButton.Location = new System.Drawing.Point(6, 42); - this.searchDirBackwardButton.Name = "searchDirBackwardButton"; - this.searchDirBackwardButton.Size = new System.Drawing.Size(73, 17); - this.searchDirBackwardButton.TabIndex = 4; - this.searchDirBackwardButton.TabStop = true; - this.searchDirBackwardButton.Text = "Backward"; - this.searchDirBackwardButton.UseVisualStyleBackColor = true; + searchDirBackwardButton.AutoSize = true; + searchDirBackwardButton.Location = new System.Drawing.Point(7, 48); + searchDirBackwardButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + searchDirBackwardButton.Name = "searchDirBackwardButton"; + searchDirBackwardButton.Size = new System.Drawing.Size(76, 19); + searchDirBackwardButton.TabIndex = 4; + searchDirBackwardButton.TabStop = true; + searchDirBackwardButton.Text = "Backward"; + searchDirBackwardButton.UseVisualStyleBackColor = true; // // searchDirForwardButton // - this.searchDirForwardButton.AutoSize = true; - this.searchDirForwardButton.Location = new System.Drawing.Point(6, 19); - this.searchDirForwardButton.Name = "searchDirForwardButton"; - this.searchDirForwardButton.Size = new System.Drawing.Size(63, 17); - this.searchDirForwardButton.TabIndex = 3; - this.searchDirForwardButton.TabStop = true; - this.searchDirForwardButton.Text = "Forward"; - this.searchDirForwardButton.UseVisualStyleBackColor = true; + searchDirForwardButton.AutoSize = true; + searchDirForwardButton.Location = new System.Drawing.Point(8, 23); + searchDirForwardButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + searchDirForwardButton.Name = "searchDirForwardButton"; + searchDirForwardButton.Size = new System.Drawing.Size(68, 19); + searchDirForwardButton.TabIndex = 3; + searchDirForwardButton.TabStop = true; + searchDirForwardButton.Text = "Forward"; + searchDirForwardButton.UseVisualStyleBackColor = true; // // optionsGroupBox // - this.optionsGroupBox.Controls.Add(this.useRegexCheckBox); - this.optionsGroupBox.Controls.Add(this.caseSensitiveCheckBox); - this.optionsGroupBox.Location = new System.Drawing.Point(15, 42); - this.optionsGroupBox.Name = "optionsGroupBox"; - this.optionsGroupBox.Size = new System.Drawing.Size(164, 65); - this.optionsGroupBox.TabIndex = 12; - this.optionsGroupBox.TabStop = false; - this.optionsGroupBox.Text = "Options"; + optionsGroupBox.Controls.Add(useRegexCheckBox); + optionsGroupBox.Controls.Add(caseSensitiveCheckBox); + optionsGroupBox.Location = new System.Drawing.Point(12, 76); + optionsGroupBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + optionsGroupBox.Name = "optionsGroupBox"; + optionsGroupBox.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); + optionsGroupBox.Size = new System.Drawing.Size(191, 75); + optionsGroupBox.TabIndex = 12; + optionsGroupBox.TabStop = false; + optionsGroupBox.Text = "Options"; // // useRegexCheckBox // - this.useRegexCheckBox.AutoSize = true; - this.useRegexCheckBox.Location = new System.Drawing.Point(6, 42); - this.useRegexCheckBox.Name = "useRegexCheckBox"; - this.useRegexCheckBox.Size = new System.Drawing.Size(74, 17); - this.useRegexCheckBox.TabIndex = 2; - this.useRegexCheckBox.Text = "Use regex"; - this.useRegexCheckBox.UseVisualStyleBackColor = true; + useRegexCheckBox.AutoSize = true; + useRegexCheckBox.Location = new System.Drawing.Point(7, 48); + useRegexCheckBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + useRegexCheckBox.Name = "useRegexCheckBox"; + useRegexCheckBox.Size = new System.Drawing.Size(76, 19); + useRegexCheckBox.TabIndex = 2; + useRegexCheckBox.Text = "Use regex"; + useRegexCheckBox.UseVisualStyleBackColor = true; // // caseSensitiveCheckBox // - this.caseSensitiveCheckBox.AutoSize = true; - this.caseSensitiveCheckBox.Location = new System.Drawing.Point(6, 19); - this.caseSensitiveCheckBox.Name = "caseSensitiveCheckBox"; - this.caseSensitiveCheckBox.Size = new System.Drawing.Size(94, 17); - this.caseSensitiveCheckBox.TabIndex = 1; - this.caseSensitiveCheckBox.Text = "Case sensitive"; - this.caseSensitiveCheckBox.UseVisualStyleBackColor = true; + caseSensitiveCheckBox.AutoSize = true; + caseSensitiveCheckBox.Location = new System.Drawing.Point(7, 22); + caseSensitiveCheckBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + caseSensitiveCheckBox.Name = "caseSensitiveCheckBox"; + caseSensitiveCheckBox.Size = new System.Drawing.Size(99, 19); + caseSensitiveCheckBox.TabIndex = 1; + caseSensitiveCheckBox.Text = "Case sensitive"; + caseSensitiveCheckBox.UseVisualStyleBackColor = true; // // progressBar1 // - this.progressBar1.Location = new System.Drawing.Point(15, 126); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(114, 23); - this.progressBar1.TabIndex = 13; + progressBar1.Location = new System.Drawing.Point(242, 98); + progressBar1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + progressBar1.Name = "progressBar1"; + progressBar1.Size = new System.Drawing.Size(133, 27); + progressBar1.TabIndex = 13; + // + // buttonReplace + // + buttonReplace.Location = new System.Drawing.Point(263, 46); + buttonReplace.Name = "buttonReplace"; + buttonReplace.Size = new System.Drawing.Size(75, 23); + buttonReplace.TabIndex = 14; + buttonReplace.Text = "Replace"; + buttonReplace.UseVisualStyleBackColor = true; + buttonReplace.Click += buttonReplace_Click; + // + // textBoxReplace + // + textBoxReplace.Location = new System.Drawing.Point(157, 47); + textBoxReplace.Name = "textBoxReplace"; + textBoxReplace.Size = new System.Drawing.Size(100, 23); + textBoxReplace.TabIndex = 15; + textBoxReplace.TextChanged += textBoxReplace_TextChanged; + // + // checkBoxReplace + // + checkBoxReplace.AutoSize = true; + checkBoxReplace.Location = new System.Drawing.Point(66, 49); + checkBoxReplace.Name = "checkBoxReplace"; + checkBoxReplace.Size = new System.Drawing.Size(67, 19); + checkBoxReplace.TabIndex = 16; + checkBoxReplace.Text = "Relative"; + checkBoxReplace.UseVisualStyleBackColor = true; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new System.Drawing.Point(12, 51); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(48, 15); + label2.TabIndex = 17; + label2.Text = "Replace"; + // + // buttonReplaceAll + // + buttonReplaceAll.Location = new System.Drawing.Point(344, 47); + buttonReplaceAll.Name = "buttonReplaceAll"; + buttonReplaceAll.Size = new System.Drawing.Size(98, 23); + buttonReplaceAll.TabIndex = 18; + buttonReplaceAll.Text = "Replace All"; + buttonReplaceAll.UseVisualStyleBackColor = true; + buttonReplaceAll.Click += buttonReplaceAll_Click; + // + // comboBoxReplace + // + comboBoxReplace.FormattingEnabled = true; + comboBoxReplace.Items.AddRange(new object[] { "absolute", "relative", "percent" }); + comboBoxReplace.Location = new System.Drawing.Point(66, 46); + comboBoxReplace.Name = "comboBoxReplace"; + comboBoxReplace.Size = new System.Drawing.Size(85, 23); + comboBoxReplace.TabIndex = 19; // // FindForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(311, 162); - this.Controls.Add(this.progressBar1); - this.Controls.Add(this.optionsGroupBox); - this.Controls.Add(this.searchDirectionGroupBox); - this.Controls.Add(this.nextButton); - this.Controls.Add(this.searchForBox); - this.Controls.Add(this.label1); - this.Controls.Add(this.closeButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Name = "FindForm"; - this.Text = "Find"; - this.Load += new System.EventHandler(this.FindForm_Load); - this.searchDirectionGroupBox.ResumeLayout(false); - this.searchDirectionGroupBox.PerformLayout(); - this.optionsGroupBox.ResumeLayout(false); - this.optionsGroupBox.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + ClientSize = new System.Drawing.Size(588, 172); + Controls.Add(comboBoxReplace); + Controls.Add(buttonReplaceAll); + Controls.Add(label2); + Controls.Add(checkBoxReplace); + Controls.Add(textBoxReplace); + Controls.Add(buttonReplace); + Controls.Add(progressBar1); + Controls.Add(optionsGroupBox); + Controls.Add(searchDirectionGroupBox); + Controls.Add(nextButton); + Controls.Add(searchForBox); + Controls.Add(label1); + Controls.Add(closeButton); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + Name = "FindForm"; + Text = "Find"; + Load += FindForm_Load; + searchDirectionGroupBox.ResumeLayout(false); + searchDirectionGroupBox.PerformLayout(); + optionsGroupBox.ResumeLayout(false); + optionsGroupBox.PerformLayout(); + ResumeLayout(false); + PerformLayout(); } @@ -197,5 +279,11 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox useRegexCheckBox; private System.Windows.Forms.CheckBox caseSensitiveCheckBox; private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.Button buttonReplace; + private System.Windows.Forms.TextBox textBoxReplace; + private System.Windows.Forms.CheckBox checkBoxReplace; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button buttonReplaceAll; + private System.Windows.Forms.ComboBox comboBoxReplace; } } \ No newline at end of file diff --git a/UAssetGUI/FindForm.cs b/UAssetGUI/FindForm.cs index 43a9c22..3b7d865 100644 --- a/UAssetGUI/FindForm.cs +++ b/UAssetGUI/FindForm.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -23,6 +24,7 @@ public FindForm() searchDirForwardButton.Tag = SearchDirection.Forward; searchDirBackwardButton.Tag = SearchDirection.Backward; searchDirForwardButton.Checked = true; + comboBoxReplace.SelectedIndex = 0; } private Form1 BaseForm; @@ -202,6 +204,76 @@ private void nextButton_Click(object sender, EventArgs e) PerformSearch(ts.Token); }); } + + private void buttonReplace_Click(object sender, EventArgs e) + { + + string storedValue; + storedValue = (string)BaseForm.dataGridView1.SelectedRows[0].Cells[3].Value; + + + string input = storedValue; + string input2 = textBoxReplace.Text; + + // Konvertieren zu float + if (float.TryParse(input, out float number)) + { + if (float.TryParse(input2.Replace(".", ","), out float number2)) + { + if((string)comboBoxReplace.SelectedItem == "relative") + { + number += number2; + } + else if ((string)comboBoxReplace.SelectedItem == "absolute") + { + number = number2; + } + else if ((string)comboBoxReplace.SelectedItem == "percent") + { + float bbase = number / 100; + if (number2<0) + { + number -= bbase * Math.Abs(number2); + } + else + { + number += bbase * Math.Abs(number2); + } + } + + } + + // Zurück in String konvertieren + string result = number.ToString(); + + BaseForm.dataGridView1.SelectedRows[0].Cells[3].Value = result; + //Console.WriteLine("Ergebnis: " + result); + } + } + private void BlockingSearch() + { + SyncSettings(); + if ( + BaseForm.tableEditor == null || BaseForm.tableEditor.asset == null + ) return; + + PerformSearch(ts.Token); + } + + private void buttonReplaceAll_Click(object sender, EventArgs e) + { + BlockingSearch(); + while (BaseForm.dataGridView1.SelectedRows.Count>0) + { + buttonReplace_Click(null, null); + BlockingSearch(); + } + } + + private void textBoxReplace_TextChanged(object sender, EventArgs e) + { + + } } public enum SearchDirection diff --git a/UAssetGUI/FindForm.resx b/UAssetGUI/FindForm.resx index 29dcb1b..4f24d55 100644 --- a/UAssetGUI/FindForm.resx +++ b/UAssetGUI/FindForm.resx @@ -1,17 +1,17 @@  - From 56df705b41d2e2e782c89abe298d3137c111cbd5 Mon Sep 17 00:00:00 2001 From: DraToXo <93015857+DraToXo@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:24:14 +0100 Subject: [PATCH 2/8] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 14085fc..5dd9ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ TestResults UAssetGUI/bin UAssetGUI/obj UAssetGUI/git_commit.txt +UAssetGUI/Properties/Settings.settings +UAssetGUI/Properties/Settings.Designer.cs From f9e97a2c48a6c51bcdc559e51cdf8d510cbb448d Mon Sep 17 00:00:00 2001 From: DraToXo <93015857+DraToXo@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:17:31 +0100 Subject: [PATCH 3/8] Updated find form added status text changed layout --- UAssetGUI/FindForm.Designer.cs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/UAssetGUI/FindForm.Designer.cs b/UAssetGUI/FindForm.Designer.cs index d1cf8da..f4761ee 100644 --- a/UAssetGUI/FindForm.Designer.cs +++ b/UAssetGUI/FindForm.Designer.cs @@ -46,6 +46,7 @@ private void InitializeComponent() label2 = new System.Windows.Forms.Label(); buttonReplaceAll = new System.Windows.Forms.Button(); comboBoxReplace = new System.Windows.Forms.ComboBox(); + labelStatus = new System.Windows.Forms.Label(); searchDirectionGroupBox.SuspendLayout(); optionsGroupBox.SuspendLayout(); SuspendLayout(); @@ -56,7 +57,7 @@ private void InitializeComponent() closeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; closeButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); closeButton.ForeColor = System.Drawing.SystemColors.ControlText; - closeButton.Location = new System.Drawing.Point(467, 93); + closeButton.Location = new System.Drawing.Point(354, 81); closeButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); closeButton.Name = "closeButton"; closeButton.Size = new System.Drawing.Size(88, 30); @@ -89,7 +90,7 @@ private void InitializeComponent() nextButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; nextButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); nextButton.ForeColor = System.Drawing.SystemColors.ControlText; - nextButton.Location = new System.Drawing.Point(354, 12); + nextButton.Location = new System.Drawing.Point(354, 7); nextButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); nextButton.Name = "nextButton"; nextButton.Size = new System.Drawing.Size(88, 30); @@ -102,7 +103,7 @@ private void InitializeComponent() // searchDirectionGroupBox.Controls.Add(searchDirBackwardButton); searchDirectionGroupBox.Controls.Add(searchDirForwardButton); - searchDirectionGroupBox.Location = new System.Drawing.Point(460, 12); + searchDirectionGroupBox.Location = new System.Drawing.Point(211, 81); searchDirectionGroupBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); searchDirectionGroupBox.Name = "searchDirectionGroupBox"; searchDirectionGroupBox.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); @@ -172,10 +173,10 @@ private void InitializeComponent() // // progressBar1 // - progressBar1.Location = new System.Drawing.Point(242, 98); + progressBar1.Location = new System.Drawing.Point(344, 129); progressBar1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); progressBar1.Name = "progressBar1"; - progressBar1.Size = new System.Drawing.Size(133, 27); + progressBar1.Size = new System.Drawing.Size(98, 27); progressBar1.TabIndex = 13; // // buttonReplace @@ -217,7 +218,7 @@ private void InitializeComponent() // // buttonReplaceAll // - buttonReplaceAll.Location = new System.Drawing.Point(344, 47); + buttonReplaceAll.Location = new System.Drawing.Point(344, 46); buttonReplaceAll.Name = "buttonReplaceAll"; buttonReplaceAll.Size = new System.Drawing.Size(98, 23); buttonReplaceAll.TabIndex = 18; @@ -234,11 +235,21 @@ private void InitializeComponent() comboBoxReplace.Size = new System.Drawing.Size(85, 23); comboBoxReplace.TabIndex = 19; // + // labelStatus + // + labelStatus.AutoSize = true; + labelStatus.Location = new System.Drawing.Point(12, 154); + labelStatus.Name = "labelStatus"; + labelStatus.Size = new System.Drawing.Size(39, 15); + labelStatus.TabIndex = 20; + labelStatus.Text = "Status"; + // // FindForm // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - ClientSize = new System.Drawing.Size(588, 172); + ClientSize = new System.Drawing.Size(446, 214); + Controls.Add(labelStatus); Controls.Add(comboBoxReplace); Controls.Add(buttonReplaceAll); Controls.Add(label2); @@ -285,5 +296,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label2; private System.Windows.Forms.Button buttonReplaceAll; private System.Windows.Forms.ComboBox comboBoxReplace; + private System.Windows.Forms.Label labelStatus; } } \ No newline at end of file From a9f65172bee9bdea32380981de57f8fb3e6990de Mon Sep 17 00:00:00 2001 From: DraToXo <93015857+DraToXo@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:19:25 +0100 Subject: [PATCH 4/8] Added error messages --- UAssetGUI/FindForm.cs | 47 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/UAssetGUI/FindForm.cs b/UAssetGUI/FindForm.cs index 3b7d865..b2a4c75 100644 --- a/UAssetGUI/FindForm.cs +++ b/UAssetGUI/FindForm.cs @@ -207,20 +207,39 @@ private void nextButton_Click(object sender, EventArgs e) private void buttonReplace_Click(object sender, EventArgs e) { - + if (BaseForm.dataGridView1.SelectedRows.Count < 1) + { + labelStatus.Text = "No row selected please insert a name and click above the desired value."; + return; + } + if (BaseForm.dataGridView1.SelectedRows[0].Cells.Count < 4) + { + labelStatus.Text = "Not enough cells (cant edit on this position.)"; + return; + } string storedValue; storedValue = (string)BaseForm.dataGridView1.SelectedRows[0].Cells[3].Value; - + if (storedValue == null) + { + labelStatus.Text = "Cell is null."; + return; + } + string input = storedValue; string input2 = textBoxReplace.Text; + if (String.IsNullOrEmpty(input2)) + { + labelStatus.Text = "Replace field is empty."; + return; + } // Konvertieren zu float if (float.TryParse(input, out float number)) { if (float.TryParse(input2.Replace(".", ","), out float number2)) { - if((string)comboBoxReplace.SelectedItem == "relative") + if ((string)comboBoxReplace.SelectedItem == "relative") { number += number2; } @@ -231,7 +250,7 @@ private void buttonReplace_Click(object sender, EventArgs e) else if ((string)comboBoxReplace.SelectedItem == "percent") { float bbase = number / 100; - if (number2<0) + if (number2 < 0) { number -= bbase * Math.Abs(number2); } @@ -240,15 +259,31 @@ private void buttonReplace_Click(object sender, EventArgs e) number += bbase * Math.Abs(number2); } } + else + { + labelStatus.Text = "Selected method is not implemented."; + return; + } } + else + { + labelStatus.Text = "Replace field only accept numbers."; + return; + } + - // Zurück in String konvertieren - string result = number.ToString(); + // Zurück in String konvertieren + string result = number.ToString(); BaseForm.dataGridView1.SelectedRows[0].Cells[3].Value = result; //Console.WriteLine("Ergebnis: " + result); } + else + { + labelStatus.Text = "Cell content is not a number only number are allowed."; + return; + } } private void BlockingSearch() { From 823c9805ea91321bd87083920d6b28bc5b7467f2 Mon Sep 17 00:00:00 2001 From: DraToXo <93015857+DraToXo@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:20:11 +0100 Subject: [PATCH 5/8] Bugfix allowed setting percentage to zero --- UAssetGUI/FindForm.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UAssetGUI/FindForm.cs b/UAssetGUI/FindForm.cs index b2a4c75..4a129d3 100644 --- a/UAssetGUI/FindForm.cs +++ b/UAssetGUI/FindForm.cs @@ -254,10 +254,14 @@ private void buttonReplace_Click(object sender, EventArgs e) { number -= bbase * Math.Abs(number2); } - else + else if(number2 > 0) { number += bbase * Math.Abs(number2); } + else + { + number = 0; + } } else { From b6f64aee15b253ec859dd3043b22e259e974a646 Mon Sep 17 00:00:00 2001 From: DraToXo <93015857+DraToXo@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:26:53 +0100 Subject: [PATCH 6/8] Changed layout aligned controls --- UAssetGUI/FindForm.Designer.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/UAssetGUI/FindForm.Designer.cs b/UAssetGUI/FindForm.Designer.cs index f4761ee..512164c 100644 --- a/UAssetGUI/FindForm.Designer.cs +++ b/UAssetGUI/FindForm.Designer.cs @@ -53,11 +53,11 @@ private void InitializeComponent() // // closeButton // - closeButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + closeButton.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; closeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; closeButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); closeButton.ForeColor = System.Drawing.SystemColors.ControlText; - closeButton.Location = new System.Drawing.Point(354, 81); + closeButton.Location = new System.Drawing.Point(354, 75); closeButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); closeButton.Name = "closeButton"; closeButton.Size = new System.Drawing.Size(88, 30); @@ -86,11 +86,11 @@ private void InitializeComponent() // // nextButton // - nextButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + nextButton.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; nextButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; nextButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); nextButton.ForeColor = System.Drawing.SystemColors.ControlText; - nextButton.Location = new System.Drawing.Point(354, 7); + nextButton.Location = new System.Drawing.Point(354, 14); nextButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); nextButton.Name = "nextButton"; nextButton.Size = new System.Drawing.Size(88, 30); @@ -103,7 +103,7 @@ private void InitializeComponent() // searchDirectionGroupBox.Controls.Add(searchDirBackwardButton); searchDirectionGroupBox.Controls.Add(searchDirForwardButton); - searchDirectionGroupBox.Location = new System.Drawing.Point(211, 81); + searchDirectionGroupBox.Location = new System.Drawing.Point(211, 76); searchDirectionGroupBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); searchDirectionGroupBox.Name = "searchDirectionGroupBox"; searchDirectionGroupBox.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); @@ -173,7 +173,7 @@ private void InitializeComponent() // // progressBar1 // - progressBar1.Location = new System.Drawing.Point(344, 129); + progressBar1.Location = new System.Drawing.Point(344, 124); progressBar1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); progressBar1.Name = "progressBar1"; progressBar1.Size = new System.Drawing.Size(98, 27); @@ -238,6 +238,7 @@ private void InitializeComponent() // labelStatus // labelStatus.AutoSize = true; + labelStatus.ForeColor = System.Drawing.Color.Crimson; labelStatus.Location = new System.Drawing.Point(12, 154); labelStatus.Name = "labelStatus"; labelStatus.Size = new System.Drawing.Size(39, 15); @@ -248,9 +249,10 @@ private void InitializeComponent() // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - ClientSize = new System.Drawing.Size(446, 214); + ClientSize = new System.Drawing.Size(446, 172); Controls.Add(labelStatus); Controls.Add(comboBoxReplace); + Controls.Add(searchDirectionGroupBox); Controls.Add(buttonReplaceAll); Controls.Add(label2); Controls.Add(checkBoxReplace); @@ -258,7 +260,6 @@ private void InitializeComponent() Controls.Add(buttonReplace); Controls.Add(progressBar1); Controls.Add(optionsGroupBox); - Controls.Add(searchDirectionGroupBox); Controls.Add(nextButton); Controls.Add(searchForBox); Controls.Add(label1); From 856a4406630b97816e5258b3f5b251bec230a028 Mon Sep 17 00:00:00 2001 From: DraToXo <93015857+DraToXo@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:57:39 +0100 Subject: [PATCH 7/8] Auto Formating --- UAssetGUI/FindForm.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/UAssetGUI/FindForm.cs b/UAssetGUI/FindForm.cs index 4a129d3..001a286 100644 --- a/UAssetGUI/FindForm.cs +++ b/UAssetGUI/FindForm.cs @@ -225,7 +225,7 @@ private void buttonReplace_Click(object sender, EventArgs e) labelStatus.Text = "Cell is null."; return; } - + string input = storedValue; string input2 = textBoxReplace.Text; if (String.IsNullOrEmpty(input2)) @@ -254,7 +254,7 @@ private void buttonReplace_Click(object sender, EventArgs e) { number -= bbase * Math.Abs(number2); } - else if(number2 > 0) + else if (number2 > 0) { number += bbase * Math.Abs(number2); } @@ -268,7 +268,7 @@ private void buttonReplace_Click(object sender, EventArgs e) labelStatus.Text = "Selected method is not implemented."; return; } - + } else { @@ -277,8 +277,8 @@ private void buttonReplace_Click(object sender, EventArgs e) } - // Zurück in String konvertieren - string result = number.ToString(); + // Zurück in String konvertieren + string result = number.ToString(); BaseForm.dataGridView1.SelectedRows[0].Cells[3].Value = result; //Console.WriteLine("Ergebnis: " + result); @@ -302,7 +302,7 @@ private void BlockingSearch() private void buttonReplaceAll_Click(object sender, EventArgs e) { BlockingSearch(); - while (BaseForm.dataGridView1.SelectedRows.Count>0) + while (BaseForm.dataGridView1.SelectedRows.Count > 0) { buttonReplace_Click(null, null); BlockingSearch(); From 90c935acb0f9633418acc64e794619d48d18af75 Mon Sep 17 00:00:00 2001 From: DraToXo <93015857+DraToXo@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:59:17 +0100 Subject: [PATCH 8/8] Final layout Changed ui element positions for a better look removed unused control --- UAssetGUI/FindForm.Designer.cs | 80 ++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/UAssetGUI/FindForm.Designer.cs b/UAssetGUI/FindForm.Designer.cs index 512164c..5c2618e 100644 --- a/UAssetGUI/FindForm.Designer.cs +++ b/UAssetGUI/FindForm.Designer.cs @@ -42,11 +42,12 @@ private void InitializeComponent() progressBar1 = new System.Windows.Forms.ProgressBar(); buttonReplace = new System.Windows.Forms.Button(); textBoxReplace = new System.Windows.Forms.TextBox(); - checkBoxReplace = new System.Windows.Forms.CheckBox(); label2 = new System.Windows.Forms.Label(); buttonReplaceAll = new System.Windows.Forms.Button(); comboBoxReplace = new System.Windows.Forms.ComboBox(); labelStatus = new System.Windows.Forms.Label(); + label3 = new System.Windows.Forms.Label(); + label4 = new System.Windows.Forms.Label(); searchDirectionGroupBox.SuspendLayout(); optionsGroupBox.SuspendLayout(); SuspendLayout(); @@ -57,7 +58,7 @@ private void InitializeComponent() closeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; closeButton.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); closeButton.ForeColor = System.Drawing.SystemColors.ControlText; - closeButton.Location = new System.Drawing.Point(354, 75); + closeButton.Location = new System.Drawing.Point(354, 188); closeButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); closeButton.Name = "closeButton"; closeButton.Size = new System.Drawing.Size(88, 30); @@ -78,7 +79,7 @@ private void InitializeComponent() // // searchForBox // - searchForBox.Location = new System.Drawing.Point(90, 18); + searchForBox.Location = new System.Drawing.Point(91, 18); searchForBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); searchForBox.Name = "searchForBox"; searchForBox.Size = new System.Drawing.Size(258, 23); @@ -103,7 +104,7 @@ private void InitializeComponent() // searchDirectionGroupBox.Controls.Add(searchDirBackwardButton); searchDirectionGroupBox.Controls.Add(searchDirForwardButton); - searchDirectionGroupBox.Location = new System.Drawing.Point(211, 76); + searchDirectionGroupBox.Location = new System.Drawing.Point(211, 146); searchDirectionGroupBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); searchDirectionGroupBox.Name = "searchDirectionGroupBox"; searchDirectionGroupBox.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); @@ -140,7 +141,7 @@ private void InitializeComponent() // optionsGroupBox.Controls.Add(useRegexCheckBox); optionsGroupBox.Controls.Add(caseSensitiveCheckBox); - optionsGroupBox.Location = new System.Drawing.Point(12, 76); + optionsGroupBox.Location = new System.Drawing.Point(12, 146); optionsGroupBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); optionsGroupBox.Name = "optionsGroupBox"; optionsGroupBox.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); @@ -173,17 +174,19 @@ private void InitializeComponent() // // progressBar1 // - progressBar1.Location = new System.Drawing.Point(344, 124); + progressBar1.Location = new System.Drawing.Point(354, 162); progressBar1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); progressBar1.Name = "progressBar1"; - progressBar1.Size = new System.Drawing.Size(98, 27); + progressBar1.Size = new System.Drawing.Size(88, 20); progressBar1.TabIndex = 13; // // buttonReplace // - buttonReplace.Location = new System.Drawing.Point(263, 46); + buttonReplace.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); + buttonReplace.Location = new System.Drawing.Point(354, 51); + buttonReplace.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); buttonReplace.Name = "buttonReplace"; - buttonReplace.Size = new System.Drawing.Size(75, 23); + buttonReplace.Size = new System.Drawing.Size(88, 30); buttonReplace.TabIndex = 14; buttonReplace.Text = "Replace"; buttonReplace.UseVisualStyleBackColor = true; @@ -191,26 +194,16 @@ private void InitializeComponent() // // textBoxReplace // - textBoxReplace.Location = new System.Drawing.Point(157, 47); + textBoxReplace.Location = new System.Drawing.Point(91, 55); textBoxReplace.Name = "textBoxReplace"; - textBoxReplace.Size = new System.Drawing.Size(100, 23); + textBoxReplace.Size = new System.Drawing.Size(257, 23); textBoxReplace.TabIndex = 15; textBoxReplace.TextChanged += textBoxReplace_TextChanged; // - // checkBoxReplace - // - checkBoxReplace.AutoSize = true; - checkBoxReplace.Location = new System.Drawing.Point(66, 49); - checkBoxReplace.Name = "checkBoxReplace"; - checkBoxReplace.Size = new System.Drawing.Size(67, 19); - checkBoxReplace.TabIndex = 16; - checkBoxReplace.Text = "Relative"; - checkBoxReplace.UseVisualStyleBackColor = true; - // // label2 // label2.AutoSize = true; - label2.Location = new System.Drawing.Point(12, 51); + label2.Location = new System.Drawing.Point(19, 58); label2.Name = "label2"; label2.Size = new System.Drawing.Size(48, 15); label2.TabIndex = 17; @@ -218,9 +211,11 @@ private void InitializeComponent() // // buttonReplaceAll // - buttonReplaceAll.Location = new System.Drawing.Point(344, 46); + buttonReplaceAll.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold); + buttonReplaceAll.Location = new System.Drawing.Point(354, 87); + buttonReplaceAll.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); buttonReplaceAll.Name = "buttonReplaceAll"; - buttonReplaceAll.Size = new System.Drawing.Size(98, 23); + buttonReplaceAll.Size = new System.Drawing.Size(88, 30); buttonReplaceAll.TabIndex = 18; buttonReplaceAll.Text = "Replace All"; buttonReplaceAll.UseVisualStyleBackColor = true; @@ -230,32 +225,52 @@ private void InitializeComponent() // comboBoxReplace.FormattingEnabled = true; comboBoxReplace.Items.AddRange(new object[] { "absolute", "relative", "percent" }); - comboBoxReplace.Location = new System.Drawing.Point(66, 46); + comboBoxReplace.Location = new System.Drawing.Point(91, 91); comboBoxReplace.Name = "comboBoxReplace"; - comboBoxReplace.Size = new System.Drawing.Size(85, 23); + comboBoxReplace.Size = new System.Drawing.Size(257, 23); comboBoxReplace.TabIndex = 19; + comboBoxReplace.SelectedIndexChanged += comboBoxReplace_SelectedIndexChanged; // // labelStatus // labelStatus.AutoSize = true; labelStatus.ForeColor = System.Drawing.Color.Crimson; - labelStatus.Location = new System.Drawing.Point(12, 154); + labelStatus.Location = new System.Drawing.Point(91, 224); labelStatus.Name = "labelStatus"; - labelStatus.Size = new System.Drawing.Size(39, 15); + labelStatus.Size = new System.Drawing.Size(0, 15); labelStatus.TabIndex = 20; - labelStatus.Text = "Status"; + labelStatus.Click += labelStatus_Click; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new System.Drawing.Point(19, 94); + label3.Name = "label3"; + label3.Size = new System.Drawing.Size(49, 15); + label3.TabIndex = 21; + label3.Text = "Method"; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new System.Drawing.Point(19, 224); + label4.Name = "label4"; + label4.Size = new System.Drawing.Size(39, 15); + label4.TabIndex = 22; + label4.Text = "Status"; // // FindForm // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - ClientSize = new System.Drawing.Size(446, 172); + ClientSize = new System.Drawing.Size(446, 248); + Controls.Add(label4); + Controls.Add(label3); Controls.Add(labelStatus); Controls.Add(comboBoxReplace); Controls.Add(searchDirectionGroupBox); Controls.Add(buttonReplaceAll); Controls.Add(label2); - Controls.Add(checkBoxReplace); Controls.Add(textBoxReplace); Controls.Add(buttonReplace); Controls.Add(progressBar1); @@ -293,10 +308,11 @@ private void InitializeComponent() private System.Windows.Forms.ProgressBar progressBar1; private System.Windows.Forms.Button buttonReplace; private System.Windows.Forms.TextBox textBoxReplace; - private System.Windows.Forms.CheckBox checkBoxReplace; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button buttonReplaceAll; private System.Windows.Forms.ComboBox comboBoxReplace; private System.Windows.Forms.Label labelStatus; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; } } \ No newline at end of file