diff --git a/Binary.sln b/Binary.sln
index 8213460..617813b 100644
--- a/Binary.sln
+++ b/Binary.sln
@@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILWrapper", "..\ILWrapper\I
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Endscript", "..\Endscript\Endscript\Endscript.csproj", "{ACC9EEB0-18B8-4EBA-B9D0-739E9C4501A1}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreExtensions", "..\CoreExtensions\CoreExtensions\CoreExtensions.csproj", "{4C6FAA97-A899-4EFC-94B0-9E0DA55FB99B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@ Global
{ACC9EEB0-18B8-4EBA-B9D0-739E9C4501A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACC9EEB0-18B8-4EBA-B9D0-739E9C4501A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACC9EEB0-18B8-4EBA-B9D0-739E9C4501A1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4C6FAA97-A899-4EFC-94B0-9E0DA55FB99B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4C6FAA97-A899-4EFC-94B0-9E0DA55FB99B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4C6FAA97-A899-4EFC-94B0-9E0DA55FB99B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4C6FAA97-A899-4EFC-94B0-9E0DA55FB99B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Binary/Binary.csproj b/Binary/Binary.csproj
index 6baddec..fa16f91 100644
--- a/Binary/Binary.csproj
+++ b/Binary/Binary.csproj
@@ -5,7 +5,7 @@
netcoreapp3.1
true
binary.ico
- 2.1.0
+ 2.5.5
MaxHwoy
Tool for editing Need for Speed binary files (.BIN, .BUN, .LZC).
Copyright © 2020 MaxHwoy
@@ -26,12 +26,6 @@
-
-
- ..\..\Nikki\Nikki\CoreExtensions.dll
-
-
-
Form
diff --git a/Binary/Editor.cs b/Binary/Editor.cs
index 924a5be..12eb08f 100644
--- a/Binary/Editor.cs
+++ b/Binary/Editor.cs
@@ -386,6 +386,22 @@ private void EMSMainNewLauncher_Click(object sender, EventArgs e)
{
using var form = new LanMaker();
form.ShowDialog();
+
+ if (form.WasCreated)
+ {
+
+ var result = MessageBox.Show("New launcher was created. Would you like to load it?", "Prompt",
+ MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+
+ if (result == DialogResult.Yes)
+ {
+
+ this.LoadProfile(form.NewLanPath, true);
+
+ }
+
+ }
+
}
private void EMSMainLoadFiles_Click(object sender, EventArgs e)
@@ -856,12 +872,12 @@ private void EMSWindowsNew_Click(object sender, EventArgs e)
private void EMSHelpAbout_Click(object sender, EventArgs e)
{
- MessageBox.Show("Binary by MaxHwoy v2.1.0", "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ MessageBox.Show("Binary by MaxHwoy v2.5.5", "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void EMSHelpTutorials_Click(object sender, EventArgs e)
{
- MessageBox.Show("Coming soon TM", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ MessageBox.Show("Join Discord server at the start page to get help and full tool documentation!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
#endregion
@@ -1369,9 +1385,9 @@ private void LoadProfile(string filename, bool showerrors)
this.EditorPropertyGrid.SelectedObject = null;
this.Profile = BaseProfile.NewProfile(launch.GameID, launch.Directory);
+ this.EditorStatusLabel.Text = "Loading... Please wait...";
var watch = new Stopwatch();
- this.EditorStatusLabel.Text = "Loading... Please wait...";
watch.Start();
this.Profile.Load(launch);
@@ -1459,8 +1475,8 @@ private void SaveProfile()
{
#endif
- var watch = new Stopwatch();
this.EditorStatusLabel.Text = "Saving... Please wait...";
+ var watch = new Stopwatch();
watch.Start();
this.Profile.Save();
@@ -1521,7 +1537,7 @@ private void EditorTreeView_AfterSelect(object sender, TreeViewEventArgs e)
this.ManageButtonScriptNode(e.Node);
this.EditorPropertyGrid.SelectedObject = selected;
- this.EditorNodeInfo.Text = $"| {e.Node.Nodes.Count} subnodes";
+ this.EditorNodeInfo.Text = $"| Index: {e.Node.Index} | {e.Node.Nodes.Count} subnodes";
}
private void EditorTreeView_DoubleClick(object sender, EventArgs e)
diff --git a/Binary/Interact/AttribCreator.cs b/Binary/Interact/AttribCreator.cs
index 4988506..46467f6 100644
--- a/Binary/Interact/AttribCreator.cs
+++ b/Binary/Interact/AttribCreator.cs
@@ -99,31 +99,39 @@ private void PopulateAttribTypesBasedOnGame(GameINT game)
this.AttribTypeComboBox.SelectedIndex = 0;
break;
+ case GameINT.Underground1:
case GameINT.Underground2:
case GameINT.MostWanted:
this.AttribTypeComboBox.Items.AddRange(new string[]
{
Boolean, ///
+ ///
+ ///
Floating, ///
+ ///
+ ///
Integer, ///
+ ///
+ ///
Key, ///
+ ///
+ ///
String, ///
+ ///
+ ///
});
this.AttribTypeComboBox.SelectedIndex = 0;
break;
- case GameINT.Underground1:
- break;
-
default:
break;
}
diff --git a/Binary/Interact/LanMaker.cs b/Binary/Interact/LanMaker.cs
index 61e86a1..46866c2 100644
--- a/Binary/Interact/LanMaker.cs
+++ b/Binary/Interact/LanMaker.cs
@@ -10,6 +10,8 @@ namespace Binary.Interact
public partial class LanMaker : Form
{
private bool IsValidDirectoryChosen => Directory.Exists(this.LanMakerTextBoxDir.Text);
+ public bool WasCreated { get; private set; }
+ public string NewLanPath { get; private set; }
public LanMaker()
{
@@ -90,6 +92,9 @@ private void LanMakerButtonSave_Click(object sender, EventArgs e)
MessageBox.Show($"File {dialog.FileName} has been saved.", "Success",
MessageBoxButtons.OK, MessageBoxIcon.Information);
+ this.WasCreated = true;
+ this.NewLanPath = dialog.FileName;
+
}
}
diff --git a/Binary/IntroUI.Designer.cs b/Binary/IntroUI.Designer.cs
index 7f717c7..4eff935 100644
--- a/Binary/IntroUI.Designer.cs
+++ b/Binary/IntroUI.Designer.cs
@@ -31,8 +31,10 @@ private void InitializeComponent()
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(IntroUI));
this.IntroPanelModder = new System.Windows.Forms.Panel();
+ this.label1 = new System.Windows.Forms.Label();
this.IntroPictureModder = new System.Windows.Forms.PictureBox();
this.IntroPanelUser = new System.Windows.Forms.Panel();
+ this.label2 = new System.Windows.Forms.Label();
this.IntroPictureUser = new System.Windows.Forms.PictureBox();
this.IntroToolTip = new System.Windows.Forms.ToolTip(this.components);
this.LabelBinary = new System.Windows.Forms.Label();
@@ -56,12 +58,24 @@ private void InitializeComponent()
//
// IntroPanelModder
//
+ this.IntroPanelModder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.IntroPanelModder.Controls.Add(this.label1);
this.IntroPanelModder.Controls.Add(this.IntroPictureModder);
this.IntroPanelModder.Location = new System.Drawing.Point(322, 77);
this.IntroPanelModder.Name = "IntroPanelModder";
this.IntroPanelModder.Size = new System.Drawing.Size(300, 300);
this.IntroPanelModder.TabIndex = 0;
//
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.label1.Location = new System.Drawing.Point(96, 3);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(118, 21);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Modder Mode";
+ //
// IntroPictureModder
//
this.IntroPictureModder.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -69,9 +83,9 @@ private void InitializeComponent()
| System.Windows.Forms.AnchorStyles.Right)));
this.IntroPictureModder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.IntroPictureModder.Cursor = System.Windows.Forms.Cursors.Hand;
- this.IntroPictureModder.Location = new System.Drawing.Point(0, 0);
+ this.IntroPictureModder.Location = new System.Drawing.Point(0, 30);
this.IntroPictureModder.Name = "IntroPictureModder";
- this.IntroPictureModder.Size = new System.Drawing.Size(300, 300);
+ this.IntroPictureModder.Size = new System.Drawing.Size(298, 268);
this.IntroPictureModder.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.IntroPictureModder.TabIndex = 0;
this.IntroPictureModder.TabStop = false;
@@ -79,12 +93,24 @@ private void InitializeComponent()
//
// IntroPanelUser
//
+ this.IntroPanelUser.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.IntroPanelUser.Controls.Add(this.label2);
this.IntroPanelUser.Controls.Add(this.IntroPictureUser);
this.IntroPanelUser.Location = new System.Drawing.Point(16, 77);
this.IntroPanelUser.Name = "IntroPanelUser";
this.IntroPanelUser.Size = new System.Drawing.Size(300, 300);
this.IntroPanelUser.TabIndex = 1;
//
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.label2.Location = new System.Drawing.Point(103, 3);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(92, 21);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "User Mode";
+ //
// IntroPictureUser
//
this.IntroPictureUser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -92,9 +118,9 @@ private void InitializeComponent()
| System.Windows.Forms.AnchorStyles.Right)));
this.IntroPictureUser.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.IntroPictureUser.Cursor = System.Windows.Forms.Cursors.Hand;
- this.IntroPictureUser.Location = new System.Drawing.Point(0, 0);
+ this.IntroPictureUser.Location = new System.Drawing.Point(0, 30);
this.IntroPictureUser.Name = "IntroPictureUser";
- this.IntroPictureUser.Size = new System.Drawing.Size(300, 300);
+ this.IntroPictureUser.Size = new System.Drawing.Size(298, 268);
this.IntroPictureUser.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.IntroPictureUser.TabIndex = 0;
this.IntroPictureUser.TabStop = false;
@@ -104,10 +130,10 @@ private void InitializeComponent()
//
this.LabelBinary.AutoSize = true;
this.LabelBinary.Cursor = System.Windows.Forms.Cursors.Hand;
- this.LabelBinary.Font = new System.Drawing.Font("Fugaz One", 30F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this.LabelBinary.Location = new System.Drawing.Point(238, 9);
+ this.LabelBinary.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.LabelBinary.Location = new System.Drawing.Point(250, 18);
this.LabelBinary.Name = "LabelBinary";
- this.LabelBinary.Size = new System.Drawing.Size(162, 59);
+ this.LabelBinary.Size = new System.Drawing.Size(139, 46);
this.LabelBinary.TabIndex = 2;
this.LabelBinary.Text = "Binary";
this.LabelBinary.Click += new System.EventHandler(this.LabelBinary_Click);
@@ -200,8 +226,10 @@ private void InitializeComponent()
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Binary by MaxHwoy";
this.IntroPanelModder.ResumeLayout(false);
+ this.IntroPanelModder.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.IntroPictureModder)).EndInit();
this.IntroPanelUser.ResumeLayout(false);
+ this.IntroPanelUser.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.IntroPictureUser)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxUpdates)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxMaximized)).EndInit();
@@ -228,5 +256,7 @@ private void InitializeComponent()
private System.Windows.Forms.PictureBox PictureBoxAutoBackups;
private System.Windows.Forms.PictureBox PictureBoxSoon;
private System.Windows.Forms.PictureBox PictureBoxTheme;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
}
}
\ No newline at end of file
diff --git a/Binary/IntroUI.cs b/Binary/IntroUI.cs
index 63bce11..ed18554 100644
--- a/Binary/IntroUI.cs
+++ b/Binary/IntroUI.cs
@@ -87,19 +87,21 @@ private void IntroPictureUser_Click(object sender, EventArgs e)
private void IntroPictureModder_Click(object sender, EventArgs e)
{
- // If password check was not done yet
+ // If password check was not done yet (deprecated)
+ /*
if (!Configurations.Default.PassPassed)
{
using var form = new ModderPass();
if (form.ShowDialog() != DialogResult.OK)
{
-
+
return;
-
+
}
}
+ */
this.ModderInteract();
ForcedX.GCCollect();
@@ -325,12 +327,12 @@ private void AskForGameRun(BaseProfile profile)
private void PictureBoxDiscord_Click(object sender, EventArgs e)
{
- Utils.OpenBrowser("https://discord.gg/jzksXXn");
+ Utils.OpenBrowser("https://discord.gg/xy5TjTa");
}
private void PictureBoxUpdates_Click(object sender, EventArgs e)
{
- MessageBox.Show("No updates yet, follow discord server for news", "Updates");
+ Utils.OpenBrowser("https://github.com/SpeedReflect/Binary/tags");
}
private void PictureBoxAutoBackups_Click(object sender, EventArgs e)
@@ -368,7 +370,7 @@ private void PictureBoxSoon_Click(object sender, EventArgs e)
private void LabelBinary_Click(object sender, EventArgs e)
{
- MessageBox.Show("Binary by MaxHwoy v2.1.0", "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ MessageBox.Show("Binary by MaxHwoy v2.5.5", "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
diff --git a/Binary/Program.cs b/Binary/Program.cs
index 26a550a..06c858b 100644
--- a/Binary/Program.cs
+++ b/Binary/Program.cs
@@ -76,14 +76,35 @@ static void Main()
private static void SetDependencyPaths(string thispath)
{
- CarbonProfile.MainHashList = Path.Combine(thispath, @"mainkeys\carbon.txt");
- CarbonProfile.CustomHashList = Path.Combine(thispath, @"userkeys\carbon.txt");
- MostWantedProfile.MainHashList = Path.Combine(thispath, @"mainkeys\mostwanted.txt");
- MostWantedProfile.CustomHashList = Path.Combine(thispath, @"userkeys\mostwanted.txt");
- Underground2Profile.MainHashList = Path.Combine(thispath, @"mainkeys\underground2.txt");
- Underground2Profile.CustomHashList = Path.Combine(thispath, @"userkeys\underground2.txt");
- ProstreetProfile.MainHashList = Path.Combine(thispath, @"mainkeys\prostreet.txt");
- ProstreetProfile.CustomHashList = Path.Combine(thispath, @"userkeys\prostreet.txt");
+ var userdir = Path.Combine(thispath, "userkeys");
+ var mainc = Path.Combine(thispath, @"mainkeys\carbon.txt");
+ var userc = Path.Combine(thispath, @"userkeys\carbon.txt");
+ var mainmw = Path.Combine(thispath, @"mainkeys\mostwanted.txt");
+ var usermw = Path.Combine(thispath, @"userkeys\mostwanted.txt");
+ var mainps = Path.Combine(thispath, @"mainkeys\prostreet.txt");
+ var userps = Path.Combine(thispath, @"userkeys\prostreet.txt");
+ var mainug1 = Path.Combine(thispath, @"mainkeys\underground1.txt");
+ var userug1 = Path.Combine(thispath, @"userkeys\underground1.txt");
+ var mainug2 = Path.Combine(thispath, @"mainkeys\underground2.txt");
+ var userug2 = Path.Combine(thispath, @"userkeys\underground2.txt");
+
+ CarbonProfile.MainHashList = mainc;
+ CarbonProfile.CustomHashList = userc;
+ MostWantedProfile.MainHashList = mainmw;
+ MostWantedProfile.CustomHashList = usermw;
+ ProstreetProfile.MainHashList = mainps;
+ ProstreetProfile.CustomHashList = userps;
+ Underground1Profile.MainHashList = mainug1;
+ Underground1Profile.CustomHashList = userug1;
+ Underground2Profile.MainHashList = mainug2;
+ Underground2Profile.CustomHashList = userug2;
+
+ if (!Directory.Exists(userdir)) Directory.CreateDirectory(userdir);
+ if (!File.Exists(userc)) { using var _ = File.Create(userc); }
+ if (!File.Exists(usermw)) { using var _ = File.Create(usermw); }
+ if (!File.Exists(userps)) { using var _ = File.Create(userps); }
+ if (!File.Exists(userug1)) { using var _ = File.Create(userug1); }
+ if (!File.Exists(userug2)) { using var _ = File.Create(userug2); }
}
public static void ThreadExceptionHandler(object sender, ThreadExceptionEventArgs e)
@@ -112,8 +133,8 @@ public static void ThreadExceptionHandler(object sender, ThreadExceptionEventArg
if (form is Editor editor)
{
- editor.EmergencySaveDatabase();
- MessageBox.Show("Database backup up.", "Done");
+ //editor.EmergencySaveDatabase();
+ //MessageBox.Show("Database backup up.", "Done");
}
diff --git a/Binary/Prompt/Check.cs b/Binary/Prompt/Check.cs
index 6bd908a..452a252 100644
--- a/Binary/Prompt/Check.cs
+++ b/Binary/Prompt/Check.cs
@@ -15,11 +15,16 @@ public Check()
this.ToggleTheme();
}
- public Check(string desc, bool prompt) : this()
+ public Check(string desc, bool prompt) : this(desc, prompt, false)
+ {
+ }
+
+ public Check(string desc, bool prompt, bool initiallyChecked) : this()
{
this.CheckButtonCancel.Enabled = !prompt;
this.ControlBox = !prompt;
this.CheckBoxSelection.Text = desc ?? String.Empty;
+ this.CheckBoxSelection.Checked = initiallyChecked;
}
private void ToggleTheme()
diff --git a/Binary/Prompt/Input.cs b/Binary/Prompt/Input.cs
index 15da0b1..de0d06c 100644
--- a/Binary/Prompt/Input.cs
+++ b/Binary/Prompt/Input.cs
@@ -13,19 +13,22 @@ public partial class Input : Form
private readonly string _error_message;
public string Value { get; private set; } = String.Empty;
- public Input() : this(input, null, invalid) { }
+ public Input() : this(input, null, invalid, null) { }
- public Input(string text) : this(text, null, invalid) { }
+ public Input(string text) : this(text, null, invalid, null) { }
- public Input(string text, Predicate inputcheck) : this(text, inputcheck, invalid) { }
+ public Input(string text, Predicate inputcheck) : this(text, inputcheck, invalid, null) { }
- public Input(string text, Predicate inputcheck, string error)
+ public Input(string text, Predicate inputcheck, string error) : this(text, inputcheck, error, null) { }
+
+ public Input(string text, Predicate inputcheck, string error, string initial)
{
this.InitializeComponent();
this.ToggleTheme();
this.InputLabel.Text = text;
this._input_check = inputcheck;
this._error_message = error;
+ this.InputTextBox.Text = initial ?? String.Empty;
}
private void ToggleTheme()
diff --git a/Binary/Tools/Raider.cs b/Binary/Tools/Raider.cs
index 516be9b..40da797 100644
--- a/Binary/Tools/Raider.cs
+++ b/Binary/Tools/Raider.cs
@@ -59,15 +59,20 @@ private void ChooseSearchMode_SelectedIndexChanged(object sender, EventArgs e)
private void BinHashInput_TextChanged(object sender, EventArgs e)
{
- if (!this.BinHashInput.ReadOnly && this.BinHashInput.Text.IsHexString())
+ var value = this.BinHashInput.Text.StartsWith("0x")
+ ? this.BinHashInput.Text
+ : $"0x{this.BinHashInput.Text}";
+
+ if (!this.BinHashInput.ReadOnly && value.IsHexString())
{
- if (this.BinHashInput.Text.Length > 10) return;
+
+ if (value.Length > 10) { this.StringGuessed.Text = "N/A"; return; }
var key = Convert.ToUInt32(this.BinHashInput.Text, 16);
this.BinFileInput.Text = $"0x{key.Reverse():X8}";
- this.StringGuessed.Text = Map.BinKeys.TryGetValue(key, out var value)
- ? value
+ this.StringGuessed.Text = Map.BinKeys.TryGetValue(key, out var result)
+ ? result
: "N/A";
}
@@ -75,17 +80,21 @@ private void BinHashInput_TextChanged(object sender, EventArgs e)
private void BinFileInput_TextChanged(object sender, EventArgs e)
{
- if (!this.BinFileInput.ReadOnly && this.BinFileInput.Text.IsHexString())
+ var value = this.BinFileInput.Text.StartsWith("0x")
+ ? this.BinFileInput.Text
+ : $"0x{this.BinFileInput.Text}";
+
+ if (!this.BinFileInput.ReadOnly && value.IsHexString())
{
- if (this.BinHashInput.Text.Length > 10) return;
+ if (value.Length > 10) { this.StringGuessed.Text = "N/A"; return; }
var key = Convert.ToUInt32(this.BinFileInput.Text, 16);
key = key.Reverse();
this.BinHashInput.Text = $"0x{key:X8}";
- this.StringGuessed.Text = Map.BinKeys.TryGetValue(key, out var value)
- ? value
+ this.StringGuessed.Text = Map.BinKeys.TryGetValue(key, out var result)
+ ? result
: "N/A";
}
}
diff --git a/Binary/UI/CarPartsEditor.Designer.cs b/Binary/UI/CarPartsEditor.Designer.cs
index da87402..f7637a7 100644
--- a/Binary/UI/CarPartsEditor.Designer.cs
+++ b/Binary/UI/CarPartsEditor.Designer.cs
@@ -51,6 +51,7 @@ private void InitializeComponent()
this.MoveDownAttributesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ReverseAttributesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SortAttributesByKeyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.AddCustomAttributeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.HasherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RaiderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -227,7 +228,8 @@ private void InitializeComponent()
this.MoveUpAttributesToolStripMenuItem,
this.MoveDownAttributesToolStripMenuItem,
this.ReverseAttributesToolStripMenuItem,
- this.SortAttributesByKeyToolStripMenuItem});
+ this.SortAttributesByKeyToolStripMenuItem,
+ this.AddCustomAttributeToolStripMenuItem});
this.AttributesToolStripMenuItem.Name = "AttributesToolStripMenuItem";
this.AttributesToolStripMenuItem.Size = new System.Drawing.Size(71, 20);
this.AttributesToolStripMenuItem.Text = "Attributes";
@@ -278,6 +280,13 @@ private void InitializeComponent()
this.SortAttributesByKeyToolStripMenuItem.Text = "Sort Attributes By Key";
this.SortAttributesByKeyToolStripMenuItem.Click += new System.EventHandler(this.SortAttributesByKeyToolStripMenuItem_Click);
//
+ // AddCustomAttributeToolStripMenuItem
+ //
+ this.AddCustomAttributeToolStripMenuItem.Name = "AddCustomAttributeToolStripMenuItem";
+ this.AddCustomAttributeToolStripMenuItem.Size = new System.Drawing.Size(225, 22);
+ this.AddCustomAttributeToolStripMenuItem.Text = "Add Custom Attribute";
+ this.AddCustomAttributeToolStripMenuItem.Click += new System.EventHandler(this.AddCustomAttributeToolStripMenuItem_Click);
+ //
// ToolsToolStripMenuItem
//
this.ToolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -346,6 +355,7 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem MoveUpAttributesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ReverseAttributesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem SortAttributesByKeyToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem AddCustomAttributeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem HasherToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem RaiderToolStripMenuItem;
diff --git a/Binary/UI/CarPartsEditor.cs b/Binary/UI/CarPartsEditor.cs
index 097d2a7..85b04da 100644
--- a/Binary/UI/CarPartsEditor.cs
+++ b/Binary/UI/CarPartsEditor.cs
@@ -30,12 +30,7 @@ public CarPartsEditor(DBModelPart model)
this.LoadTreeView();
this.ToggleMenuStripControls(null);
- if (this.Model.GameINT != GameINT.MostWanted && this.Model.GameINT != GameINT.Underground2)
- {
-
- this.FindAndReplaceToolStripMenuItem.Enabled = false;
-
- }
+ this.FindAndReplaceToolStripMenuItem.Enabled = true;
}
#region Theme
@@ -105,6 +100,8 @@ private void ToggleTheme()
this.ReverseAttributesToolStripMenuItem.ForeColor = Theme.MenuItemForeColor;
this.SortAttributesByKeyToolStripMenuItem.BackColor = Theme.MenuItemBackColor;
this.SortAttributesByKeyToolStripMenuItem.ForeColor = Theme.MenuItemForeColor;
+ this.AddCustomAttributeToolStripMenuItem.BackColor = Theme.MenuItemBackColor;
+ this.AddCustomAttributeToolStripMenuItem.ForeColor = Theme.MenuItemForeColor;
this.HasherToolStripMenuItem.BackColor = Theme.MenuItemBackColor;
this.HasherToolStripMenuItem.ForeColor = Theme.MenuItemForeColor;
this.RaiderToolStripMenuItem.BackColor = Theme.MenuItemBackColor;
@@ -234,6 +231,7 @@ private void ToggleMenuStripControls(TreeNode node)
this.MoveDownAttributesToolStripMenuItem.Enabled = false;
this.ReverseAttributesToolStripMenuItem.Enabled = false;
this.SortAttributesByKeyToolStripMenuItem.Enabled = false;
+ this.AddCustomAttributeToolStripMenuItem.Enabled = false;
}
else
@@ -254,6 +252,7 @@ private void ToggleMenuStripControls(TreeNode node)
this.MoveDownAttributesToolStripMenuItem.Enabled = node.Level == 1;
this.ReverseAttributesToolStripMenuItem.Enabled = node.Level == 0;
this.SortAttributesByKeyToolStripMenuItem.Enabled = node.Level == 0;
+ this.AddCustomAttributeToolStripMenuItem.Enabled = node.Level == 0;
}
}
@@ -483,6 +482,14 @@ private void FindAndReplaceToolStripMenuItem_Click(object sende, EventArgs e)
{
if (this.CarPartsTreeView.Nodes.Count == 0) return;
+ // 4 windows:
+ // 1. String to replace with
+ // 2. String to replace itself
+ // 3. Do case sensitive search
+ // 4. Replace only PartLabel or absolutely everything
+
+
+ // 1 & 2
using var with = new Input("Enter string to replace with");
using var input = new Input("Enter string to search for",
new Predicate(_ => !String.IsNullOrEmpty(_)),
@@ -491,30 +498,38 @@ private void FindAndReplaceToolStripMenuItem_Click(object sende, EventArgs e)
if (input.ShowDialog() == DialogResult.OK && with.ShowDialog() == DialogResult.OK)
{
+ // 3
using var check = new Check("Make case-sensitive replace?", false);
if (check.ShowDialog() == DialogResult.OK)
{
+ // Make regex options based on result of 3
var options = check.Value
? RegexOptions.Multiline | RegexOptions.CultureInvariant
: RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase;
- this.CarPartsTreeView.BeginUpdate();
+ // 4
+ using var all = new Check("Make replacement only in PartLabel?", false, true);
- for (int i = 0; i < this.Model.CarPartsCount; ++i)
+ if (all.ShowDialog() == DialogResult.OK)
{
- // Very quick and dirty way to replace node's and part's name
- var part = this.Model.GetRealPart(i);
- var value = part.GetValue("PartLabel");
- value = Regex.Replace(value, input.Value, with.Value, options);
- part.SetValue("PartLabel", value);
- this.CarPartsTreeView.Nodes[i].Text = value;
+ this.CarPartsTreeView.BeginUpdate();
- }
+ for (int i = 0; i < this.Model.CarPartsCount; ++i)
+ {
- this.CarPartsTreeView.EndUpdate();
+ var part = this.Model.GetRealPart(i);
+ part.MakeReplace(all.Value, input.Value, with.Value, options);
+ this.CarPartsTreeView.Nodes[i].Text = part.PartName;
+
+ }
+
+ this.CarPartsTreeView.EndUpdate();
+ this.CarPartsPropertyGrid.Refresh();
+
+ }
}
@@ -551,7 +566,9 @@ private void RemoveAttributeToolStripMenuItem_Click(object sender, EventArgs e)
var realpart = this.Model.GetRealPart(node.Parent.Index);
realpart.Attributes.RemoveAt(node.Index);
this.CarPartsTreeView.SelectedNode = node.Parent;
+ node.Parent.Text = realpart.PartName;
node.Parent.Nodes.RemoveAt(node.Index);
+ this.CarPartsPropertyGrid.Refresh();
}
private void MoveUpAttributesToolStripMenuItem_Click(object sender, EventArgs e)
@@ -627,6 +644,28 @@ private void SortAttributesByKeyToolStripMenuItem_Click(object sender, EventArgs
this.LoadTreeView(this.CarPartsTreeView.SelectedNode.FullPath);
}
+ private void AddCustomAttributeToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var creator = new Input
+ (
+ "Input name of new custom attribute",
+ new Predicate(_ => !String.IsNullOrEmpty(_)),
+ "Name of an attribute cannot be empty"
+ );
+
+ if (creator.ShowDialog() == DialogResult.OK)
+ {
+
+ var node = this.CarPartsTreeView.SelectedNode;
+ var realpart = this.Model.GetRealPart(node.Index);
+ realpart.AddCustomAttribute(creator.Value);
+ var attribute = realpart.Attributes[^1];
+ node.Nodes.Add(attribute.ToString());
+ this.CarPartsPropertyGrid.Refresh();
+
+ }
+ }
+
private void HasherToolStripMenuItem_Click(object sender, EventArgs e)
{
var hasher = new Hasher() { StartPosition = FormStartPosition.CenterScreen };
diff --git a/Binary/UI/CareerEditor.cs b/Binary/UI/CareerEditor.cs
index 20e2765..b266b71 100644
--- a/Binary/UI/CareerEditor.cs
+++ b/Binary/UI/CareerEditor.cs
@@ -473,6 +473,7 @@ private void GenerateUpdateInCareerCommand(string nodepath, string property, str
string command = String.Empty;
if (property.Contains(' ')) property = $"\"{property}\"";
if (value.Contains(' ')) property = $"\"{value}\"";
+ if (String.IsNullOrEmpty(value)) value = "\"\"";
if (splits.Length == 2)
{
diff --git a/Binary/UI/StringEditor.cs b/Binary/UI/StringEditor.cs
index e36c5f2..8eabcd4 100644
--- a/Binary/UI/StringEditor.cs
+++ b/Binary/UI/StringEditor.cs
@@ -22,9 +22,12 @@ public partial class StringEditor : Form
private const string TText = "Text";
private STRBlock STR { get; }
private readonly List