diff --git a/BG3 Mini Tool/BG3 Mini Tool.csproj b/BG3 Mini Tool/BG3 Mini Tool.csproj index 04676af..20ec369 100644 --- a/BG3 Mini Tool/BG3 Mini Tool.csproj +++ b/BG3 Mini Tool/BG3 Mini Tool.csproj @@ -28,6 +28,9 @@ + + Form + True True diff --git a/BG3 Mini Tool/Form1.Designer.cs b/BG3 Mini Tool/Form1.Designer.cs index 9df2d8e..1e6a123 100644 --- a/BG3 Mini Tool/Form1.Designer.cs +++ b/BG3 Mini Tool/Form1.Designer.cs @@ -38,15 +38,14 @@ private void InitializeComponent() label4 = new Label(); Button4 = new Button(); label5 = new Label(); - button2 = new Button(); - button3 = new Button(); + button5 = new Button(); SuspendLayout(); // // label1 // label1.AutoSize = true; label1.Font = new Font("Microsoft Sans Serif", 15.75F, FontStyle.Bold, GraphicsUnit.Point); - label1.Location = new Point(26, 152); + label1.Location = new Point(23, 166); label1.Name = "label1"; label1.Size = new Size(271, 25); label1.TabIndex = 5; @@ -66,11 +65,11 @@ private void InitializeComponent() // Button1 // Button1.AutoSize = true; - Button1.Location = new Point(12, 182); + Button1.Location = new Point(54, 194); Button1.Name = "Button1"; - Button1.Size = new Size(299, 65); + Button1.Size = new Size(205, 65); Button1.TabIndex = 25; - Button1.Text = "CharacterCreationAppearanceVisuals\r\n"; + Button1.Text = "Character Creation"; Button1.UseVisualStyleBackColor = true; Button1.Click += Button1_Click; // @@ -107,7 +106,7 @@ private void InitializeComponent() // Button4 // Button4.AutoSize = true; - Button4.Location = new Point(100, 429); + Button4.Location = new Point(96, 373); Button4.Name = "Button4"; Button4.Size = new Size(121, 41); Button4.TabIndex = 29; @@ -119,42 +118,30 @@ private void InitializeComponent() // label5.AutoSize = true; label5.Font = new Font("Microsoft Sans Serif", 15.75F, FontStyle.Bold, GraphicsUnit.Point); - label5.Location = new Point(64, 401); + label5.Location = new Point(59, 345); label5.Name = "label5"; label5.Size = new Size(185, 25); label5.TabIndex = 30; label5.Text = "Tools Separated"; // - // button2 + // button5 // - button2.AutoSize = true; - button2.Location = new Point(21, 253); - button2.Name = "button2"; - button2.Size = new Size(276, 65); - button2.TabIndex = 31; - button2.Text = "32 CCAV Entries for All at Once"; - button2.UseVisualStyleBackColor = true; - button2.Click += button2_Click_2; - // - // button3 - // - button3.AutoSize = true; - button3.Location = new Point(21, 324); - button3.Name = "button3"; - button3.Size = new Size(276, 65); - button3.TabIndex = 32; - button3.Text = "Add VFX to Custom Heads"; - button3.UseVisualStyleBackColor = true; - button3.Click += button3_Click_1; + button5.AutoSize = true; + button5.Location = new Point(54, 265); + button5.Name = "button5"; + button5.Size = new Size(205, 65); + button5.TabIndex = 33; + button5.Text = "Localization Editor"; + button5.UseVisualStyleBackColor = true; + button5.Click += button5_Click; // // Form1 // AutoScaleDimensions = new SizeF(9F, 20F); AutoScaleMode = AutoScaleMode.Font; BackColor = SystemColors.ButtonShadow; - ClientSize = new Size(324, 520); - Controls.Add(button3); - Controls.Add(button2); + ClientSize = new Size(316, 437); + Controls.Add(button5); Controls.Add(label5); Controls.Add(Button4); Controls.Add(label4); @@ -166,7 +153,7 @@ private void InitializeComponent() Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); Margin = new Padding(4, 5, 4, 5); Name = "Form1"; - Text = "Menu"; + Text = "BG3 Mini Tool Home Page"; Load += Form1_Load; Resize += Form1_Resize; ResumeLayout(false); @@ -183,7 +170,6 @@ private void InitializeComponent() private Label label4; private Button Button4; private Label label5; - private Button button2; - private Button button3; + private Button button5; } } \ No newline at end of file diff --git a/BG3 Mini Tool/Form1.cs b/BG3 Mini Tool/Form1.cs index 02d4c95..2ebb1a6 100644 --- a/BG3 Mini Tool/Form1.cs +++ b/BG3 Mini Tool/Form1.cs @@ -13,11 +13,13 @@ namespace BG3_Mini_Tool { public partial class Form1 : Form { - private Form3? form3Instance; + public Form1() { InitializeComponent(); } + + private Form3? form3Instance; private void Button16_Click(object sender, EventArgs e) { if (form3Instance == null) @@ -31,28 +33,19 @@ private void Button16_Click(object sender, EventArgs e) form3Instance.BringToFront(); } } - private void Button2_Click(object sender, EventArgs e) - { - - } - - private void Button3_Click(object sender, EventArgs e) - { - } - - private Form2? Form2Instance; + private Form11? Form11Instance; private void Button1_Click(object sender, EventArgs e) { - if (Form2Instance == null) + if (Form11Instance == null) { - Form2Instance = new Form2(); - Form2Instance.Show(); + Form11Instance = new Form11(); + Form11Instance.Show(); } else { - Form2Instance.Show(); - Form2Instance.BringToFront(); + Form11Instance.Show(); + Form11Instance.BringToFront(); } } @@ -99,32 +92,18 @@ private void Form1_Resize(object sender, EventArgs e) this.Size = new Size(302, 460); } - private Form8 Form8Instance; - - private void button2_Click_2(object sender, EventArgs e) - { - if (Form8Instance == null || Form8Instance.IsDisposed) - { - Form8Instance = new Form8(); - } - - Form8Instance.Show(); - Form8Instance.BringToFront(); - } - - private Form10? Form10Instance; - - private void button3_Click_1(object sender, EventArgs e) + private Form5? Form5Instance; + private void button5_Click(object sender, EventArgs e) { - if (Form10Instance == null) + if (Form5Instance == null) { - Form10Instance = new Form10(); - Form10Instance.Show(); + Form5Instance = new Form5(); + Form5Instance.Show(); } else { - Form10Instance.Show(); - Form10Instance.BringToFront(); + Form5Instance.Show(); + Form5Instance.BringToFront(); } } } diff --git a/BG3 Mini Tool/Form11.Designer.cs b/BG3 Mini Tool/Form11.Designer.cs new file mode 100644 index 0000000..25f0c56 --- /dev/null +++ b/BG3 Mini Tool/Form11.Designer.cs @@ -0,0 +1,132 @@ +namespace BG3_Mini_Tool +{ + partial class Form11 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + button3 = new Button(); + Button1 = new Button(); + label1 = new Label(); + button4 = new Button(); + label5 = new Label(); + label2 = new Label(); + SuspendLayout(); + // + // button3 + // + button3.AutoSize = true; + button3.Location = new Point(58, 243); + button3.Name = "button3"; + button3.Size = new Size(276, 65); + button3.TabIndex = 35; + button3.Text = "Add VFX to Custom Heads"; + button3.UseVisualStyleBackColor = true; + button3.Click += button3_Click; + // + // Button1 + // + Button1.AutoSize = true; + Button1.Location = new Point(80, 76); + Button1.Name = "Button1"; + Button1.Size = new Size(240, 65); + Button1.TabIndex = 33; + Button1.Text = "CCAV One Entry at a Time"; + Button1.UseVisualStyleBackColor = true; + Button1.Click += Button1_Click; + // + // label1 + // + label1.AutoSize = true; + label1.Font = new Font("Microsoft Sans Serif", 18F, FontStyle.Bold, GraphicsUnit.Point); + label1.Location = new Point(88, 9); + label1.Name = "label1"; + label1.Size = new Size(232, 29); + label1.TabIndex = 36; + label1.Text = "Character Creation"; + // + // button4 + // + button4.AutoSize = true; + button4.Location = new Point(23, 147); + button4.Name = "button4"; + button4.Size = new Size(351, 65); + button4.TabIndex = 37; + button4.Text = "CCAV Entries for All, Short, Default and Strong"; + button4.UseVisualStyleBackColor = true; + button4.Click += button4_Click; + // + // label5 + // + label5.AutoSize = true; + label5.Font = new Font("Microsoft Sans Serif", 15.75F, FontStyle.Bold, GraphicsUnit.Point); + label5.Location = new Point(161, 215); + label5.Name = "label5"; + label5.Size = new Size(70, 25); + label5.TabIndex = 38; + label5.Text = "Other"; + // + // label2 + // + label2.AutoSize = true; + label2.Font = new Font("Microsoft Sans Serif", 15.75F, FontStyle.Bold, GraphicsUnit.Point); + label2.Location = new Point(0, 48); + label2.Name = "label2"; + label2.Size = new Size(407, 25); + label2.TabIndex = 39; + label2.Text = "CharacterCreationAppearanceVisuals\r\n"; + // + // Form11 + // + AutoScaleDimensions = new SizeF(9F, 20F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = SystemColors.ButtonShadow; + ClientSize = new Size(403, 318); + Controls.Add(label2); + Controls.Add(label5); + Controls.Add(button4); + Controls.Add(label1); + Controls.Add(button3); + Controls.Add(Button1); + Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); + Margin = new Padding(4); + Name = "Form11"; + Text = "Character Creation"; + FormClosing += Form11_FormClosing; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button button3; + private Button Button1; + private Label label1; + private Button button4; + private Label label5; + private Label label2; + } +} \ No newline at end of file diff --git a/BG3 Mini Tool/Form11.cs b/BG3 Mini Tool/Form11.cs new file mode 100644 index 0000000..a64c92e --- /dev/null +++ b/BG3 Mini Tool/Form11.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace BG3_Mini_Tool +{ + public partial class Form11 : Form + { + public Form11() + { + InitializeComponent(); + } + + private Form2? Form2Instance; + private void Button1_Click(object sender, EventArgs e) + { + if (Form2Instance == null) + { + Form2Instance = new Form2(); + Form2Instance.Show(); + } + else + { + Form2Instance.Show(); + Form2Instance.BringToFront(); + } + } + + private Form10? Form10Instance; + + private void button3_Click(object sender, EventArgs e) + { + if (Form10Instance == null) + { + Form10Instance = new Form10(); + Form10Instance.Show(); + } + else + { + Form10Instance.Show(); + Form10Instance.BringToFront(); + } + } + + private Form8 Form8Instance; + + private void button2_Click(object sender, EventArgs e) + { + if (Form8Instance == null || Form8Instance.IsDisposed) + { + Form8Instance = new Form8(); + } + + Form8Instance.Show(); + Form8Instance.BringToFront(); + } + + private void Form11_FormClosing(object sender, FormClosingEventArgs e) + { + e.Cancel = true; // Cancel the form closing event + this.Hide(); // Hide the form instead of closing it + } + + private Form12 Form12Instance; + + private void button4_Click(object sender, EventArgs e) + { + if (Form12Instance == null || Form12Instance.IsDisposed) + { + Form12Instance = new Form12(); + } + + Form12Instance.Show(); + Form12Instance.BringToFront(); + + } + } +} diff --git a/BG3 Mini Tool/Form11.resx b/BG3 Mini Tool/Form11.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/BG3 Mini Tool/Form11.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BG3 Mini Tool/Form12.Designer.cs b/BG3 Mini Tool/Form12.Designer.cs new file mode 100644 index 0000000..6537352 --- /dev/null +++ b/BG3 Mini Tool/Form12.Designer.cs @@ -0,0 +1,469 @@ +namespace BG3_Mini_Tool +{ + partial class Form12 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + Button6 = new Button(); + button14 = new Button(); + comboBox1 = new ComboBox(); + label6 = new Label(); + button19 = new Button(); + Button_locateLSX = new Button(); + textBoxpath = new TextBox(); + Button_add = new Button(); + button18 = new Button(); + Button_saveas = new Button(); + label4 = new Label(); + textBoxVisualResource = new TextBox(); + label5 = new Label(); + button2 = new Button(); + button3 = new Button(); + button1 = new Button(); + label1 = new Label(); + label13 = new Label(); + button4 = new Button(); + label2 = new Label(); + textBox1 = new TextBox(); + button5 = new Button(); + label21 = new Label(); + textBoxNameHandle = new TextBox(); + button9 = new Button(); + button7 = new Button(); + button8 = new Button(); + button10 = new Button(); + button11 = new Button(); + button12 = new Button(); + comboBoxFileType = new ComboBox(); + SuspendLayout(); + // + // Button6 + // + Button6.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Button6.Location = new Point(136, 265); + Button6.Name = "Button6"; + Button6.Size = new Size(219, 31); + Button6.TabIndex = 94; + Button6.Text = "Generate Unique UUIDs"; + Button6.UseVisualStyleBackColor = true; + Button6.Click += Button6_Click; + // + // button14 + // + button14.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button14.Location = new Point(566, 193); + button14.Name = "button14"; + button14.Size = new Size(44, 31); + button14.TabIndex = 152; + button14.Text = "?"; + button14.UseVisualStyleBackColor = true; + button14.Click += button14_Click; + // + // comboBox1 + // + comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; + comboBox1.FormattingEnabled = true; + comboBox1.Location = new Point(136, 195); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(348, 28); + comboBox1.TabIndex = 150; + comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged; + comboBox1.Click += comboBox1_Click; + // + // label6 + // + label6.AutoSize = true; + label6.Location = new Point(50, 198); + label6.Margin = new Padding(4, 0, 4, 0); + label6.Name = "label6"; + label6.Size = new Size(79, 20); + label6.TabIndex = 149; + label6.Text = "SlotName"; + // + // button19 + // + button19.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button19.Location = new Point(384, 412); + button19.Name = "button19"; + button19.Size = new Size(44, 31); + button19.TabIndex = 178; + button19.Text = "?"; + button19.UseVisualStyleBackColor = true; + button19.Click += button19_Click; + // + // Button_locateLSX + // + Button_locateLSX.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Button_locateLSX.Location = new Point(136, 303); + Button_locateLSX.Name = "Button_locateLSX"; + Button_locateLSX.Size = new Size(458, 31); + Button_locateLSX.TabIndex = 177; + Button_locateLSX.Text = "Locate your CharacterCreationAppearanceVisuals.lsx"; + Button_locateLSX.UseVisualStyleBackColor = true; + Button_locateLSX.Click += Button_locateLSX_Click; + // + // textBoxpath + // + textBoxpath.Location = new Point(136, 342); + textBoxpath.Margin = new Padding(4, 5, 4, 5); + textBoxpath.Name = "textBoxpath"; + textBoxpath.Size = new Size(508, 26); + textBoxpath.TabIndex = 176; + // + // Button_add + // + Button_add.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Button_add.Location = new Point(136, 413); + Button_add.Name = "Button_add"; + Button_add.Size = new Size(173, 31); + Button_add.TabIndex = 175; + Button_add.Text = "Add to your mod file"; + Button_add.UseVisualStyleBackColor = true; + Button_add.Click += Button_add_Click; + // + // button18 + // + button18.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button18.Location = new Point(384, 376); + button18.Name = "button18"; + button18.Size = new Size(44, 31); + button18.TabIndex = 180; + button18.Text = "?"; + button18.UseVisualStyleBackColor = true; + button18.Click += button18_Click; + // + // Button_saveas + // + Button_saveas.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + Button_saveas.Location = new Point(136, 376); + Button_saveas.Name = "Button_saveas"; + Button_saveas.Size = new Size(140, 31); + Button_saveas.TabIndex = 179; + Button_saveas.Text = "Save as"; + Button_saveas.UseVisualStyleBackColor = true; + Button_saveas.Click += Button_saveas_Click; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(7, 231); + label4.Margin = new Padding(4, 0, 4, 0); + label4.Name = "label4"; + label4.Size = new Size(121, 20); + label4.TabIndex = 183; + label4.Text = "VisualResource"; + // + // textBoxVisualResource + // + textBoxVisualResource.Location = new Point(136, 231); + textBoxVisualResource.Margin = new Padding(4, 5, 4, 5); + textBoxVisualResource.Name = "textBoxVisualResource"; + textBoxVisualResource.Size = new Size(348, 26); + textBoxVisualResource.TabIndex = 182; + textBoxVisualResource.Text = "Same UUID as the merged"; + // + // label5 + // + label5.AutoSize = true; + label5.Location = new Point(24, 269); + label5.Margin = new Padding(4, 0, 4, 0); + label5.Name = "label5"; + label5.Size = new Size(105, 20); + label5.TabIndex = 181; + label5.Text = "Unique UUID"; + // + // button2 + // + button2.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button2.Location = new Point(566, 264); + button2.Name = "button2"; + button2.Size = new Size(44, 31); + button2.TabIndex = 184; + button2.Text = "?"; + button2.UseVisualStyleBackColor = true; + button2.Click += button2_Click; + // + // button3 + // + button3.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button3.Location = new Point(566, 228); + button3.Name = "button3"; + button3.Size = new Size(44, 31); + button3.TabIndex = 185; + button3.Text = "?"; + button3.UseVisualStyleBackColor = true; + button3.Click += button3_Click; + // + // button1 + // + button1.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button1.Location = new Point(651, 340); + button1.Name = "button1"; + button1.Size = new Size(44, 31); + button1.TabIndex = 186; + button1.Text = "?"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(57, 345); + label1.Margin = new Padding(4, 0, 4, 0); + label1.Name = "label1"; + label1.Size = new Size(71, 20); + label1.TabIndex = 187; + label1.Text = "File Path"; + // + // label13 + // + label13.AutoSize = true; + label13.Font = new Font("Microsoft Sans Serif", 15.75F, FontStyle.Bold, GraphicsUnit.Point); + label13.Location = new Point(77, 9); + label13.Name = "label13"; + label13.Size = new Size(545, 75); + label13.TabIndex = 188; + label13.Text = "CharacterCreationAppearanceVisuals \r\nAll, Shorter, Default or Strong (minus Dragonborn) \r\nRace/BodyTypes/BodyShapes at once"; + label13.TextAlign = ContentAlignment.TopCenter; + // + // button4 + // + button4.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button4.Location = new Point(566, 159); + button4.Name = "button4"; + button4.Size = new Size(44, 31); + button4.TabIndex = 191; + button4.Text = "?"; + button4.UseVisualStyleBackColor = true; + button4.Click += button4_Click; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(77, 164); + label2.Margin = new Padding(4, 0, 4, 0); + label2.Name = "label2"; + label2.Size = new Size(51, 20); + label2.TabIndex = 190; + label2.Text = "Name"; + label2.Click += label2_Click; + // + // textBox1 + // + textBox1.Location = new Point(136, 161); + textBox1.Margin = new Padding(4, 5, 4, 5); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(348, 26); + textBox1.TabIndex = 189; + textBox1.TextChanged += textBox1_TextChanged; + // + // button5 + // + button5.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + button5.Location = new Point(491, 87); + button5.Name = "button5"; + button5.Size = new Size(188, 31); + button5.TabIndex = 196; + button5.Text = "Open Localization Editor\r\n"; + button5.UseVisualStyleBackColor = true; + button5.Click += button5_Click; + // + // label21 + // + label21.AutoSize = true; + label21.Location = new Point(24, 128); + label21.Margin = new Padding(4, 0, 4, 0); + label21.Name = "label21"; + label21.Size = new Size(106, 20); + label21.TabIndex = 193; + label21.Text = "Name Handle"; + // + // textBoxNameHandle + // + textBoxNameHandle.Location = new Point(136, 125); + textBoxNameHandle.Margin = new Padding(4, 5, 4, 5); + textBoxNameHandle.Multiline = true; + textBoxNameHandle.Name = "textBoxNameHandle"; + textBoxNameHandle.Size = new Size(348, 26); + textBoxNameHandle.TabIndex = 192; + // + // button9 + // + button9.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + button9.Location = new Point(491, 229); + button9.Name = "button9"; + button9.Size = new Size(69, 31); + button9.TabIndex = 197; + button9.Text = "Update"; + button9.UseVisualStyleBackColor = true; + button9.Click += button9_Click; + // + // button7 + // + button7.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + button7.Location = new Point(491, 160); + button7.Name = "button7"; + button7.Size = new Size(69, 31); + button7.TabIndex = 198; + button7.Text = "Update"; + button7.UseVisualStyleBackColor = true; + button7.Click += button7_Click; + // + // button8 + // + button8.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + button8.Location = new Point(490, 195); + button8.Name = "button8"; + button8.Size = new Size(69, 31); + button8.TabIndex = 199; + button8.Text = "Update"; + button8.UseVisualStyleBackColor = true; + button8.Click += button8_Click; + // + // button10 + // + button10.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + button10.Location = new Point(491, 124); + button10.Name = "button10"; + button10.Size = new Size(69, 31); + button10.TabIndex = 200; + button10.Text = "Update"; + button10.UseVisualStyleBackColor = true; + button10.Click += button10_Click; + // + // button11 + // + button11.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button11.Location = new Point(566, 124); + button11.Name = "button11"; + button11.Size = new Size(44, 31); + button11.TabIndex = 201; + button11.Text = "?"; + button11.UseVisualStyleBackColor = true; + button11.Click += button11_Click; + // + // button12 + // + button12.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point); + button12.Location = new Point(290, 87); + button12.Name = "button12"; + button12.Size = new Size(195, 31); + button12.TabIndex = 202; + button12.Text = "Generate Unique Handle"; + button12.UseVisualStyleBackColor = true; + button12.Click += button12_Click; + // + // comboBoxFileType + // + comboBoxFileType.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxFileType.FormattingEnabled = true; + comboBoxFileType.Location = new Point(57, 90); + comboBoxFileType.Name = "comboBoxFileType"; + comboBoxFileType.Size = new Size(227, 28); + comboBoxFileType.TabIndex = 203; + // + // Form12 + // + AutoScaleDimensions = new SizeF(9F, 20F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = SystemColors.ButtonShadow; + ClientSize = new Size(717, 473); + Controls.Add(comboBoxFileType); + Controls.Add(button12); + Controls.Add(button11); + Controls.Add(button10); + Controls.Add(button8); + Controls.Add(button7); + Controls.Add(button9); + Controls.Add(button5); + Controls.Add(label21); + Controls.Add(textBoxNameHandle); + Controls.Add(button4); + Controls.Add(label2); + Controls.Add(textBox1); + Controls.Add(label13); + Controls.Add(label1); + Controls.Add(button1); + Controls.Add(button3); + Controls.Add(button2); + Controls.Add(label4); + Controls.Add(textBoxVisualResource); + Controls.Add(label5); + Controls.Add(button18); + Controls.Add(Button_saveas); + Controls.Add(button19); + Controls.Add(Button_locateLSX); + Controls.Add(textBoxpath); + Controls.Add(Button_add); + Controls.Add(button14); + Controls.Add(comboBox1); + Controls.Add(label6); + Controls.Add(Button6); + Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); + Margin = new Padding(4); + Name = "Form12"; + Text = "Form12"; + FormClosing += Form12_FormClosing; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button Button6; + private Button button14; + private ComboBox comboBox1; + private Label label6; + private Button button19; + private Button Button_locateLSX; + private TextBox textBoxpath; + private Button Button_add; + private Button button18; + private Button Button_saveas; + private Label label4; + private TextBox textBoxVisualResource; + private Label label5; + private Button button2; + private Button button3; + private Button button1; + private Label label1; + private Label label13; + private Button button4; + private Label label2; + private TextBox textBox1; + private Button button5; + private Label label21; + private TextBox textBoxNameHandle; + private Button button9; + private Button button7; + private Button button8; + private Button button10; + private Button button11; + private Button button12; + private ComboBox comboBoxFileType; + } +} \ No newline at end of file diff --git a/BG3 Mini Tool/Form12.cs b/BG3 Mini Tool/Form12.cs new file mode 100644 index 0000000..4ba6ad8 --- /dev/null +++ b/BG3 Mini Tool/Form12.cs @@ -0,0 +1,481 @@ +using System.Text.RegularExpressions; +using System.Xml; + +namespace BG3_Mini_Tool +{ + public partial class Form12 : Form + { + public Form12() + { + InitializeComponent(); + // Populate the dropdown with file types + comboBoxFileType.Items.Add("All"); + comboBoxFileType.Items.Add("Shorter"); + comboBoxFileType.Items.Add("Default"); + comboBoxFileType.Items.Add("Strong"); + + // Set the default selection + comboBoxFileType.SelectedIndex = 0; + } + + private string GetSelectedFileType() + { + // Get the selected file type from the dropdown + return comboBoxFileType.SelectedItem.ToString(); + } + + private void UpdateXmlFile(string fileType) + { + // Get the path of the selected XML file based on the file type + string selectedFilePath = GetSelectedFilePath(fileType); + + // Your existing code to perform XML updates goes here, replacing the hardcoded path with selectedFilePath + // For example: + // string filePath = selectedFilePath; + // ... + } + + private string GetSelectedFilePath(string fileType) + { + // Get the directory and base filename + string directory = Path.Combine(Application.StartupPath, "LSX Files"); + string baseFileName = "CharacterCreationAppearanceVisuals_For"; + + // Construct the full file path based on the selected file type + return Path.Combine(directory, $"{baseFileName}{fileType}.lsx"); + } + + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + + } + + private void comboBox1_Click(object sender, EventArgs e) + { + comboBox1.Items.Clear(); // Clear existing items + + string filePath = "LSX Files\\SlotName.txt"; + List comboBoxItems = new List(); + string[] lines = File.ReadAllLines(filePath); + foreach (string line in lines) + { + comboBox1.Items.Add(line); // Add each line to the dropdown + } + } + + private void button1_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("Path to your mod file including the name of the lsx. This is so when you click \"Add to your mod file\" your new entry is added to your file"); + } + + private void Button6_Click(object sender, EventArgs e) + { + // Get the selected file type + string selectedFileType = GetSelectedFileType(); + + // Get the path of the selected XML file based on the file type + string filePath = GetSelectedFilePath(selectedFileType); + + try + { + // Load the XML document + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(filePath); + + // Get all nodes with the attribute "id" equal to "UUID" + XmlNodeList uuidNodes = xmlDoc.SelectNodes("//attribute[@id='UUID']"); + + // Generate and replace UUIDs for each node + foreach (XmlNode uuidNode in uuidNodes) + { + // Generate a new UUID + Guid newUuid = Guid.NewGuid(); + + // Update the "value" attribute with the new UUID + XmlAttribute valueAttribute = uuidNode.Attributes["value"]; + if (valueAttribute != null) + { + valueAttribute.Value = newUuid.ToString(); + } + } + + // Save the updated XML document + xmlDoc.Save(filePath); + + MessageBox.Show("UUIDs updated successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void button9_Click(object sender, EventArgs e) + { + // Get the selected file type + string selectedFileType = GetSelectedFileType(); + + // Get the path of the selected XML file based on the file type + string filePath = GetSelectedFilePath(selectedFileType); + string newValue = textBoxVisualResource.Text.Trim(); + + try + { + // Load the XML document + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(filePath); + + // Get all nodes with the attribute "id" equal to "VisualResource" + XmlNodeList visualResourceNodes = xmlDoc.SelectNodes("//attribute[@id='VisualResource']"); + + // Update the "value" attribute for each matching node + foreach (XmlNode visualResourceNode in visualResourceNodes) + { + XmlAttribute valueAttribute = visualResourceNode.Attributes["value"]; + if (valueAttribute != null) + { + // Update the "value" attribute with the new value + valueAttribute.Value = newValue; + } + } + + // Save the updated XML document + xmlDoc.Save(filePath); + + MessageBox.Show("VisualResource values updated successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void button7_Click(object sender, EventArgs e) + { + // Get the selected file type + string selectedFileType = GetSelectedFileType(); + + // Get the path of the selected XML file based on the file type + string filePath = GetSelectedFilePath(selectedFileType); + string newText = textBox1.Text.Trim(); + + try + { + string fileContent = File.ReadAllText(filePath); + + // Use a regular expression to find and replace text within comments with different formats + string updatedContent = Regex.Replace(fileContent, @"", match => + { + return $""; + }); + + File.WriteAllText(filePath, updatedContent); + + MessageBox.Show("Text within comments updated successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + + private void button8_Click(object sender, EventArgs e) + { + // Get the selected file type + string selectedFileType = GetSelectedFileType(); + + // Get the path of the selected XML file based on the file type + string filePath = GetSelectedFilePath(selectedFileType); + string selectedValue = comboBox1.SelectedItem.ToString(); + + try + { + // Load the XML document + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(filePath); + + // Find all specific attribute nodes by their id and type + XmlNodeList attributeNodes = xmlDoc.SelectNodes("//attribute[@id='SlotName' and @type='FixedString']"); + + if (attributeNodes.Count > 0) + { + foreach (XmlElement attributeNode in attributeNodes) + { + // Update the 'value' attribute with the selected value from comboBox1 + attributeNode.SetAttribute("value", selectedValue); + } + + // Save the modified XML content back to the file + xmlDoc.Save(filePath); + + MessageBox.Show("Attributes with 'SlotName' and type 'FixedString' updated successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("No matching attributes found in XML."); + } + } + catch (Exception ex) + { + MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void Button_locateLSX_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Filter = "Text Files (*.lsx)|*.lsx|All Files (*.*)|*.*"; + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + // Set the text box text to the path of the selected file + textBoxpath.Text = openFileDialog.FileName; + } + + else + { + // Display a message if no file was selected + MessageBox.Show("Please select a CharacterCreationAppearanceVisuals.lsx"); + } + } + + private void Button_add_Click(object sender, EventArgs e) + { + // Get the selected file type + string selectedFileType = GetSelectedFileType(); + + // Get the path of the target file to add lines to + string targetFilePath = textBoxpath.Text; + + if (string.IsNullOrEmpty(targetFilePath)) + { + MessageBox.Show("Target file path cannot be empty. Please use the Locate lsx Button."); + return; + } + + // Ask for user confirmation before adding the lines + DialogResult result = MessageBox.Show($"Are you sure you want to add the lines from CharacterCreationAppearanceVisuals_{selectedFileType}.lsx to the selected file?", "Confirmation", MessageBoxButtons.YesNo); + + if (result == DialogResult.No) + { + return; + } + + try + { + // Get the path of the source file to get lines from + string sourceFilePath = GetSelectedFilePath(selectedFileType); + + // Load the XML content from the target file + XmlDocument targetXmlDoc = new XmlDocument(); + targetXmlDoc.Load(targetFilePath); + + // Load the XML content from the source file + XmlDocument sourceXmlDoc = new XmlDocument(); + sourceXmlDoc.Load(sourceFilePath); + + // Get the element from the source XML + XmlNode sourceChildrenNode = sourceXmlDoc.SelectSingleNode("//children"); + + if (sourceChildrenNode != null) + { + // Create a new XmlNodeList to hold the cloned nodes + XmlNodeList nodesToInsert = targetXmlDoc.ImportNode(sourceChildrenNode, true).ChildNodes; + + // Get the element from the target XML + XmlNode targetChildrenNode = targetXmlDoc.SelectSingleNode("//children"); + + if (targetChildrenNode != null) + { + // Append the cloned nodes at the end of the target section + foreach (XmlNode node in nodesToInsert) + { + targetChildrenNode.AppendChild(targetXmlDoc.ImportNode(node, true)); + } + + // Save the modified XML content back to the target file + targetXmlDoc.Save(targetFilePath); + + MessageBox.Show("Lines added successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("No section found in the target file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + else + { + MessageBox.Show("No section found in the source file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + catch (Exception ex) + { + MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + + private void Button_saveas_Click(object sender, EventArgs e) + { + // Get the selected file type + string selectedFileType = GetSelectedFileType(); + + // Get the current directory and the original file path + string currentDirectory = Directory.GetCurrentDirectory(); + string originalFilePath = GetSelectedFilePath(selectedFileType); + + // Show the save file dialog + SaveFileDialog saveFileDialog = new SaveFileDialog(); + saveFileDialog.Filter = "LSX Files (*.lsx)|*.lsx"; + saveFileDialog.FileName = "CharacterCreationAppearanceVisuals.lsx"; // Force the file name + + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + try + { + // Read the content from the original file + string fileContent = File.ReadAllText(originalFilePath); + + // Write the content to the new file + File.WriteAllText(saveFileDialog.FileName, fileContent); + + // Display a message with the selected version + MessageBox.Show($"File saved successfully for version: {selectedFileType}", "File Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + + private void button11_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("Make sure this matches the handle you give on the Localization editor. For assets sharing same name you can keep same handle and only are required to have it once in the xml/loca file"); + } + + private void button4_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("Just the name you want to use as a comment in the file to better organise the file if adding more to it"); + + } + + private void button14_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("Might need to double click to show all slots. Change to the slot you are making your asset for and then click update."); + } + + private void button3_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("You want this to be the same UUID you gave to your asset in the Merged VisualBank section for that asset."); + } + + private void button2_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("This button will generate a unique UUID for all the slots at once in this file."); + } + + private void button18_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("Use this if you haven't created a CharacterCreationAppearanceVisuals.lsx yet"); + + } + + private void button19_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("If you already have a CharacterCreationAppearanceVisuals.lsx you can use this to save all these new entries to your file"); + } + + private void button10_Click(object sender, EventArgs e) + { + // Get the selected file type + string selectedFileType = GetSelectedFileType(); + + // Get the path of the selected XML file based on the file type + string filePath = GetSelectedFilePath(selectedFileType); + string selectedHandle = textBoxNameHandle.Text.Trim(); + + try + { + // Load the XML content from the file + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(filePath); + + // Find all specific attribute nodes by their id + XmlNodeList attributeNodes = xmlDoc.SelectNodes("//attribute[@id='DisplayName']"); + + if (attributeNodes.Count > 0) + { + foreach (XmlElement attributeNode in attributeNodes) + { + // Update the 'handle' attribute with the selected handle from textBoxNameHandle + attributeNode.SetAttribute("handle", selectedHandle); + } + + // Save the modified XML content back to the file + xmlDoc.Save(filePath); + + MessageBox.Show("Handles for 'DisplayName' attributes updated successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("No matching attributes found in XML."); + } + } + catch (Exception ex) + { + MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private Form5? Form5Instance; + + private void button5_Click(object sender, EventArgs e) + { + if (Form5Instance == null) + { + Form5Instance = new Form5(); + Form5Instance.Show(); + } + else + { + Form5Instance.Show(); + Form5Instance.BringToFront(); + } + } + private string GenerateUniqueUuid() + { + return "h" + Guid.NewGuid().ToString("N"); + } + private void button12_Click(object sender, EventArgs e) + { + string newUuid = GenerateUniqueUuid(); + textBoxNameHandle.Text = newUuid; + } + + private void Form12_FormClosing(object sender, FormClosingEventArgs e) + { + e.Cancel = true; // Cancel the form closing event + this.Hide(); // Hide the form instead of closing it + } + + private void label2_Click(object sender, EventArgs e) + { + + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + } + } +} diff --git a/BG3 Mini Tool/Form12.resx b/BG3 Mini Tool/Form12.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/BG3 Mini Tool/Form12.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BG3 Mini Tool/Form3.cs b/BG3 Mini Tool/Form3.cs index a8cb4da..3b1b1e0 100644 --- a/BG3 Mini Tool/Form3.cs +++ b/BG3 Mini Tool/Form3.cs @@ -60,28 +60,27 @@ private void Button6_Click(object sender, EventArgs e) private void Button5_Click(object sender, EventArgs e) //Mod Creator { + string filePath = "LSX Files\\meta.lsx"; string newValue = textBox_creator.Text; - XmlDocument doc = new XmlDocument(); - doc.Load("LSX Files\\meta.lsx"); // Load the currently opened file + string[] lines = File.ReadAllLines(filePath); + string pattern = "\"Author\" type=\"LSString\" value=\""; - XmlNode authorNode = doc.SelectSingleNode("//attribute[@id='Author'][@type='LSWString']"); - if (authorNode != null) + for (int i = 0; i < lines.Length; i++) { - foreach (XmlAttribute attribute in authorNode.Attributes) + if (lines[i].Contains(pattern)) { - if (attribute.Name == "value") - { - attribute.Value = newValue; - break; - } + int startIndex = lines[i].IndexOf(pattern) + pattern.Length; + int endIndex = lines[i].IndexOf("\"", startIndex); + string linePrefix = lines[i].Substring(0, startIndex); + string lineSuffix = lines[i].Substring(endIndex); + string replacedLine = linePrefix + newValue + lineSuffix; + lines[i] = replacedLine; + break; // } - - // Save the updated XML content to the RichTextBox - StringWriter sw = new StringWriter(); - doc.Save(sw); - textBox_creator.Text = sw.ToString(); } + + File.WriteAllLines(filePath, lines); } private void Button1_Click(object sender, EventArgs e) //Mod Name @@ -165,7 +164,7 @@ private void Button4_Click(object sender, EventArgs e) //Unique UUID string newValue = textBoxUniqueUUID.Text; string[] lines = File.ReadAllLines(filePath); - string pattern = "\"UUID\" type=\"guid\" value=\""; + string pattern = "\"UUID\" type=\"FixedString\" value=\""; for (int i = 0; i < lines.Length; i++) { diff --git a/BG3 Mini Tool/Form4.Designer.cs b/BG3 Mini Tool/Form4.Designer.cs index 5a60d35..49443d6 100644 --- a/BG3 Mini Tool/Form4.Designer.cs +++ b/BG3 Mini Tool/Form4.Designer.cs @@ -54,6 +54,7 @@ private void InitializeComponent() button5 = new Button(); button2 = new Button(); button3 = new Button(); + button4 = new Button(); ((System.ComponentModel.ISupportInitialize)numericUpDown4).BeginInit(); ((System.ComponentModel.ISupportInitialize)numericUpDown3).BeginInit(); ((System.ComponentModel.ISupportInitialize)numericUpDown2).BeginInit(); @@ -301,12 +302,24 @@ private void InitializeComponent() button3.UseVisualStyleBackColor = true; button3.Click += button3_Click; // + // button4 + // + button4.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point); + button4.Location = new Point(442, 106); + button4.Name = "button4"; + button4.Size = new Size(44, 31); + button4.TabIndex = 156; + button4.Text = "?"; + button4.UseVisualStyleBackColor = true; + button4.Click += button4_Click; + // // Tools // AutoScaleDimensions = new SizeF(9F, 20F); AutoScaleMode = AutoScaleMode.Font; BackColor = SystemColors.ButtonShadow; ClientSize = new Size(584, 571); + Controls.Add(button4); Controls.Add(button3); Controls.Add(button2); Controls.Add(button5); @@ -334,7 +347,7 @@ private void InitializeComponent() Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); Margin = new Padding(4, 5, 4, 5); Name = "Tools"; - Text = "Form8"; + Text = "Extra Tools"; FormClosing += Form4_FormClosing; Resize += Tools_Resize; ((System.ComponentModel.ISupportInitialize)numericUpDown4).EndInit(); @@ -372,5 +385,6 @@ private void InitializeComponent() private Button button5; private Button button2; private Button button3; + private Button button4; } } \ No newline at end of file diff --git a/BG3 Mini Tool/Form4.cs b/BG3 Mini Tool/Form4.cs index fb97111..551d21f 100644 --- a/BG3 Mini Tool/Form4.cs +++ b/BG3 Mini Tool/Form4.cs @@ -224,7 +224,7 @@ private void textBoxHex_TextChanged(object sender, EventArgs e) try { - if (hexColor.Length == 6) + if (hexColor.Length == 6 || hexColor.Length == 8) { byte r = byte.Parse(hexColor.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); byte g = byte.Parse(hexColor.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); @@ -234,47 +234,45 @@ private void textBoxHex_TextChanged(object sender, EventArgs e) float green = g / 255.0f; float blue = b / 255.0f; - string srgbColor = $"{red:F6} {green:F6} {blue:F6}"; - srgbColor = srgbColor.Replace(" ", ""); - + string srgbColor = $"{red} {green} {blue}"; textBoxSRGB.Text = srgbColor; // Update the color of panelColorBox - panelColorBox.BackColor = Color.FromArgb(r, g, b); + if (hexColor.Length == 8) + { + byte a = byte.Parse(hexColor.Substring(6, 2), System.Globalization.NumberStyles.HexNumber); + float alpha = a / 255.0f; + srgbColor = $"{red} {green} {blue} {alpha}"; + panelColorBox.BackColor = Color.FromArgb(a, r, g, b); + } + else + { + panelColorBox.BackColor = Color.FromArgb(r, g, b); + } } - else if (hexColor.Length == 8) + else { - byte r = byte.Parse(hexColor.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); - byte g = byte.Parse(hexColor.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); - byte b = byte.Parse(hexColor.Substring(4, 2), System.Globalization.NumberStyles.HexNumber); - byte a = byte.Parse(hexColor.Substring(6, 2), System.Globalization.NumberStyles.HexNumber); - - float red = r / 255.0f; - float green = g / 255.0f; - float blue = b / 255.0f; - float alpha = a / 255.0f; - - string srgbColor = $"{red:F6} {green:F6} {blue:F6}"; - srgbColor = srgbColor.Replace(" ", ""); - - textBoxSRGB.Text = srgbColor; - - // Update the color of panelColorBox - panelColorBox.BackColor = Color.FromArgb(r, g, b, a); + throw new FormatException(); } } catch (FormatException) { - MessageBox.Show("Hex Value is not in the correct format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + // If the user didn't enter '#', prepend it and try again + if (!textBoxHex.Text.StartsWith("#") && textBoxHex.Text.Length > 0) + { + textBoxHex.Text = "#" + textBoxHex.Text; + } + else + { + MessageBox.Show("Hex Value is not in the correct format.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } - private List customColors = new List(); private void panelColorBox_Click(object sender, EventArgs e) { - // Show the ColorDialog to get the user's color selection ColorDialog colorDialog = new ColorDialog(); // Set custom colors if available @@ -283,6 +281,12 @@ private void panelColorBox_Click(object sender, EventArgs e) colorDialog.CustomColors = customColors.Select(c => ColorTranslator.ToOle(c)).ToArray(); } + // Attempt to parse the color from textBoxDirectHex + if (TryParseHexColor(textBoxHex.Text, out Color directHexColor)) + { + colorDialog.Color = directHexColor; + } + if (colorDialog.ShowDialog() == DialogResult.OK) { // Add the selected color to customColors @@ -310,6 +314,42 @@ private void panelColorBox_Click(object sender, EventArgs e) textBoxSRGB.Text = $"{red} {green} {blue}"; } } + + private bool TryParseHexColor(string hexColor, out Color color) + { + color = Color.Empty; + + hexColor = hexColor.TrimStart('#'); + + try + { + if (hexColor.Length == 6 || hexColor.Length == 8) + { + byte r = byte.Parse(hexColor.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); + byte g = byte.Parse(hexColor.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); + byte b = byte.Parse(hexColor.Substring(4, 2), System.Globalization.NumberStyles.HexNumber); + + if (hexColor.Length == 8) + { + byte a = byte.Parse(hexColor.Substring(6, 2), System.Globalization.NumberStyles.HexNumber); + color = Color.FromArgb(a, r, g, b); + } + else + { + color = Color.FromArgb(r, g, b); + } + + return true; + } + + return false; + } + catch (FormatException) + { + return false; + } + } + private void button13_Click(object sender, EventArgs e) { string srgbInput = textBoxSRGB.Text.Trim(); @@ -343,8 +383,8 @@ private void button13_Click(object sender, EventArgs e) textBoxHex.Text = hexColor; panelColorBox.BackColor = Color.FromArgb(r, g, b); - // Update textBoxSRGB with formatted values and spaces - textBoxSRGB.Text = $"{red:F7} {green:F7} {blue:F7}"; + // Update textBoxSRGB with entered values and spaces + textBoxSRGB.Text = $"{red} {green} {blue}"; } catch (FormatException) { @@ -451,11 +491,8 @@ private string ProcessUUIDsInContent(string content) insideObjectNode = false; } - // Check if the line contains any of the patterns to ignore - bool shouldIgnore = patternsToIgnore.Any(patternToIgnore => line.Contains(patternToIgnore)); - - // If we're inside an block and the line matches a pattern to ignore, skip it - if (insideObjectNode && shouldIgnore) + // If we're inside an block, skip further processing + if (insideObjectNode) { continue; } @@ -472,6 +509,27 @@ private string ProcessUUIDsInContent(string content) return uuidReplacementDict[currentUUID]; }); + + // Ignore List + bool shouldIgnore = patternsToIgnore.Any(patternToIgnore => + { + string pattern = patternToIgnore.Trim(); + + // Check if the line contains the attribute name (enclosed in double quotes) or the attribute name alone + if (line.Contains($"\"{pattern}\"") || line.Contains(pattern)) + { + return true; // Ignore the line if it matches an attribute name + } + + return false; + }); + + // If the line should be ignored, revert UUID replacement + if (shouldIgnore) + { + lines[i] = line; // Revert the line to its original state + continue; + } } // Reconstruct the updated content from the modified lines @@ -480,6 +538,7 @@ private string ProcessUUIDsInContent(string content) return updatedContent; } + private string ProcessHandlesInContent(string content) { string updatedContent = content; @@ -488,12 +547,16 @@ private string ProcessHandlesInContent(string content) // Process Handles updatedContent = Regex.Replace(updatedContent, handlePattern, match => { - string currentHandle = match.Value.Substring(match.Value.IndexOf('"') + 1, 32); + int indexOfQuote = match.Value.IndexOf('"'); + string currentHandle = !string.IsNullOrEmpty(match.Value) && indexOfQuote >= 0 + ? match.Value.Substring(indexOfQuote + 1, 32) + : string.Empty; if (!handleReplacementDict.ContainsKey(currentHandle)) { // Check if the currentHandle matches any pattern from the ignore list - bool shouldIgnore = patternsToIgnore.Any(patternToIgnore => Regex.IsMatch(currentHandle, patternToIgnore)); + bool shouldIgnore = patternsToIgnore != null && patternsToIgnore.Any(patternToIgnore => Regex.IsMatch(currentHandle, patternToIgnore)); + if (!shouldIgnore) { @@ -528,5 +591,11 @@ private void button3_Click(object sender, EventArgs e) // Display a pop-up message box with text MessageBox.Show("Add the AnimationSetBank ID to the LSX Files/IgnoreList.txt and SkeletonBank ID if using vanilla assets for those sections"); } + + private void button4_Click(object sender, EventArgs e) + { + // Display a pop-up message box with text + MessageBox.Show("Press the Colour box to open the Colour Wheel"); + } } } diff --git a/BG3 Mini Tool/Form5.Designer.cs b/BG3 Mini Tool/Form5.Designer.cs index 7efe403..44e64f3 100644 --- a/BG3 Mini Tool/Form5.Designer.cs +++ b/BG3 Mini Tool/Form5.Designer.cs @@ -400,7 +400,7 @@ private void InitializeComponent() Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); Margin = new Padding(4); Name = "Form5"; - Text = "Form5"; + Text = "Localisation Editor"; FormClosing += Form5_FormClosing; Load += Form5_Load; ResumeLayout(false); diff --git a/BG3 Mini Tool/Form8.Designer.cs b/BG3 Mini Tool/Form8.Designer.cs index 37bf7d7..7c26b88 100644 --- a/BG3 Mini Tool/Form8.Designer.cs +++ b/BG3 Mini Tool/Form8.Designer.cs @@ -69,7 +69,7 @@ private void InitializeComponent() Button6.TabIndex = 94; Button6.Text = "Generate Unique UUIDs"; Button6.UseVisualStyleBackColor = true; - Button6.Click += Button6_Click; + Button6.Click += this.Button6_Click; // // button14 // @@ -80,7 +80,7 @@ private void InitializeComponent() button14.TabIndex = 152; button14.Text = "?"; button14.UseVisualStyleBackColor = true; - button14.Click += button14_Click; + button14.Click += this.button14_Click; // // comboBox1 // @@ -90,8 +90,8 @@ private void InitializeComponent() comboBox1.Name = "comboBox1"; comboBox1.Size = new Size(348, 28); comboBox1.TabIndex = 150; - comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged; - comboBox1.Click += comboBox1_Click; + comboBox1.SelectedIndexChanged += this.comboBox1_SelectedIndexChanged; + comboBox1.Click += this.comboBox1_Click; // // label6 // @@ -112,7 +112,7 @@ private void InitializeComponent() button19.TabIndex = 178; button19.Text = "?"; button19.UseVisualStyleBackColor = true; - button19.Click += button19_Click; + button19.Click += this.button19_Click; // // Button_locateLSX // @@ -123,7 +123,7 @@ private void InitializeComponent() Button_locateLSX.TabIndex = 177; Button_locateLSX.Text = "Locate your CharacterCreationAppearanceVisuals.lsx"; Button_locateLSX.UseVisualStyleBackColor = true; - Button_locateLSX.Click += Button_locateLSX_Click; + Button_locateLSX.Click += this.Button_locateLSX_Click; // // textBoxpath // @@ -142,7 +142,7 @@ private void InitializeComponent() Button_add.TabIndex = 175; Button_add.Text = "Add to your mod file"; Button_add.UseVisualStyleBackColor = true; - Button_add.Click += Button_add_Click; + Button_add.Click += this.Button_add_Click; // // button18 // @@ -153,7 +153,7 @@ private void InitializeComponent() button18.TabIndex = 180; button18.Text = "?"; button18.UseVisualStyleBackColor = true; - button18.Click += button18_Click; + button18.Click += this.button18_Click; // // Button_saveas // @@ -164,7 +164,7 @@ private void InitializeComponent() Button_saveas.TabIndex = 179; Button_saveas.Text = "Save as"; Button_saveas.UseVisualStyleBackColor = true; - Button_saveas.Click += Button_saveas_Click; + Button_saveas.Click += this.Button_saveas_Click; // // label4 // @@ -204,7 +204,7 @@ private void InitializeComponent() button2.TabIndex = 184; button2.Text = "?"; button2.UseVisualStyleBackColor = true; - button2.Click += button2_Click; + button2.Click += this.button2_Click; // // button3 // @@ -215,7 +215,7 @@ private void InitializeComponent() button3.TabIndex = 185; button3.Text = "?"; button3.UseVisualStyleBackColor = true; - button3.Click += button3_Click; + button3.Click += this.button3_Click; // // button1 // @@ -226,7 +226,7 @@ private void InitializeComponent() button1.TabIndex = 186; button1.Text = "?"; button1.UseVisualStyleBackColor = true; - button1.Click += button1_Click; + button1.Click += this.button1_Click; // // label1 // @@ -258,7 +258,7 @@ private void InitializeComponent() button4.TabIndex = 191; button4.Text = "?"; button4.UseVisualStyleBackColor = true; - button4.Click += button4_Click; + button4.Click += this.button4_Click; // // label2 // @@ -269,7 +269,7 @@ private void InitializeComponent() label2.Size = new Size(51, 20); label2.TabIndex = 190; label2.Text = "Name"; - label2.Click += label2_Click; + label2.Click += this.label2_Click; // // textBox1 // @@ -278,7 +278,7 @@ private void InitializeComponent() textBox1.Name = "textBox1"; textBox1.Size = new Size(348, 26); textBox1.TabIndex = 189; - textBox1.TextChanged += textBox1_TextChanged; + textBox1.TextChanged += this.textBox1_TextChanged; // // button5 // @@ -289,7 +289,7 @@ private void InitializeComponent() button5.TabIndex = 196; button5.Text = "Open Localization Editor\r\n"; button5.UseVisualStyleBackColor = true; - button5.Click += button5_Click; + button5.Click += this.button5_Click; // // label21 // @@ -319,7 +319,7 @@ private void InitializeComponent() button9.TabIndex = 197; button9.Text = "Update"; button9.UseVisualStyleBackColor = true; - button9.Click += button9_Click; + button9.Click += this.button9_Click; // // button7 // @@ -330,7 +330,7 @@ private void InitializeComponent() button7.TabIndex = 198; button7.Text = "Update"; button7.UseVisualStyleBackColor = true; - button7.Click += button7_Click; + button7.Click += this.button7_Click; // // button8 // @@ -341,7 +341,7 @@ private void InitializeComponent() button8.TabIndex = 199; button8.Text = "Update"; button8.UseVisualStyleBackColor = true; - button8.Click += button8_Click; + button8.Click += this.button8_Click; // // button10 // @@ -352,7 +352,7 @@ private void InitializeComponent() button10.TabIndex = 200; button10.Text = "Update"; button10.UseVisualStyleBackColor = true; - button10.Click += button10_Click; + button10.Click += this.button10_Click; // // button11 // @@ -363,7 +363,7 @@ private void InitializeComponent() button11.TabIndex = 201; button11.Text = "?"; button11.UseVisualStyleBackColor = true; - button11.Click += button11_Click; + button11.Click += this.button11_Click; // // button12 // @@ -374,7 +374,7 @@ private void InitializeComponent() button12.TabIndex = 202; button12.Text = "Generate Unique Handle"; button12.UseVisualStyleBackColor = true; - button12.Click += button12_Click; + button12.Click += this.button12_Click; // // Form8 // @@ -416,7 +416,7 @@ private void InitializeComponent() Margin = new Padding(4); Name = "Form8"; Text = "Form8"; - FormClosing += Form8_FormClosing; + FormClosing += this.Form8_FormClosing; ResumeLayout(false); PerformLayout(); }