Add validation button
This commit is contained in:
parent
99e64e5e36
commit
8df90f628a
918
RecodeItGUI/GUI/Main.Designer.cs
generated
918
RecodeItGUI/GUI/Main.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -255,21 +255,14 @@ public partial class ReCodeItForm : Form
|
|||||||
_isSearched = false;
|
_isSearched = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
private RemapModel? CreateRemapFromGUI()
|
||||||
/// Construct a new remap when the button is pressed
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void AddRemapButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
if (NewTypeName.Text == string.Empty)
|
if (NewTypeName.Text == string.Empty)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Please enter a new type name", "Invalid data");
|
MessageBox.Show("Please enter a new type name", "Invalid data");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetSearchButton_Click(this, e);
|
|
||||||
|
|
||||||
var newRemap = new RemapModel
|
var newRemap = new RemapModel
|
||||||
{
|
{
|
||||||
Succeeded = false,
|
Succeeded = false,
|
||||||
@ -341,6 +334,22 @@ public partial class ReCodeItForm : Form
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return newRemap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Construct a new remap when the button is pressed
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void AddRemapButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ResetSearchButton_Click(this, e);
|
||||||
|
|
||||||
|
var newRemap = CreateRemapFromGUI();
|
||||||
|
|
||||||
|
if (newRemap is null) return;
|
||||||
|
|
||||||
bool projectMode = AppSettings.Remapper.UseProjectMappings;
|
bool projectMode = AppSettings.Remapper.UseProjectMappings;
|
||||||
|
|
||||||
Logger.Log(projectMode);
|
Logger.Log(projectMode);
|
||||||
@ -467,6 +476,23 @@ public partial class ReCodeItForm : Form
|
|||||||
ReloadRemapTreeView(DataProvider.Remaps);
|
ReloadRemapTreeView(DataProvider.Remaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ValidateRemapButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
List<RemapModel> validation = [];
|
||||||
|
|
||||||
|
var remapToValidate = CreateRemapFromGUI();
|
||||||
|
|
||||||
|
if (remapToValidate is null) return;
|
||||||
|
|
||||||
|
validation.Add(remapToValidate);
|
||||||
|
|
||||||
|
Remapper.InitializeRemap(
|
||||||
|
validation,
|
||||||
|
AppSettings.Remapper.AssemblyPath,
|
||||||
|
AppSettings.Remapper.OutputPath,
|
||||||
|
validate: true);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only used by the manual remap process, not apart of the cross compiler process
|
/// Only used by the manual remap process, not apart of the cross compiler process
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -117,8 +117,11 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="groupBox6.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>17, 17</value>
|
<value>False</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="groupBox7.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>False</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
|
@ -18,8 +18,4 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="DeMangler\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -19,7 +19,7 @@ public class ReCodeItRemapper
|
|||||||
public ReCodeItRemapper()
|
public ReCodeItRemapper()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
private ModuleDefMD Module { get; set; }
|
private ModuleDefMD? Module { get; set; }
|
||||||
|
|
||||||
private readonly ReCodeItCrossCompiler _compiler;
|
private readonly ReCodeItCrossCompiler _compiler;
|
||||||
|
|
||||||
@ -48,7 +48,8 @@ public class ReCodeItRemapper
|
|||||||
List<RemapModel> remapModels,
|
List<RemapModel> remapModels,
|
||||||
string assemblyPath,
|
string assemblyPath,
|
||||||
string outPath,
|
string outPath,
|
||||||
bool crossMapMode = false)
|
bool crossMapMode = false,
|
||||||
|
bool validate = false)
|
||||||
{
|
{
|
||||||
_remaps = [];
|
_remaps = [];
|
||||||
_remaps = remapModels;
|
_remaps = remapModels;
|
||||||
@ -79,6 +80,13 @@ public class ReCodeItRemapper
|
|||||||
|
|
||||||
ChooseBestMatches();
|
ChooseBestMatches();
|
||||||
|
|
||||||
|
// Don't go any further during a validation
|
||||||
|
if (validate)
|
||||||
|
{
|
||||||
|
DisplayEndBanner(validate: true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var renameTasks = new List<Task>(remapModels.Count);
|
var renameTasks = new List<Task>(remapModels.Count);
|
||||||
foreach (var remap in remapModels)
|
foreach (var remap in remapModels)
|
||||||
{
|
{
|
||||||
@ -171,9 +179,9 @@ public class ReCodeItRemapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Choose best match from a collection of scores, then start the renaming process
|
/// Choose best match from a collection of types on a remap
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scores">Scores to rate</param>
|
/// <param name="remap"></param>
|
||||||
private void ChooseBestMatch(RemapModel remap)
|
private void ChooseBestMatch(RemapModel remap)
|
||||||
{
|
{
|
||||||
if (remap.TypeCandidates.Count == 0) { return; }
|
if (remap.TypeCandidates.Count == 0) { return; }
|
||||||
@ -229,7 +237,8 @@ public class ReCodeItRemapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
Stopwatch.Reset();
|
Stopwatch.Reset();
|
||||||
|
Module = null;
|
||||||
|
|
||||||
IsRunning = false;
|
IsRunning = false;
|
||||||
OnComplete?.Invoke();
|
OnComplete?.Invoke();
|
||||||
}
|
}
|
||||||
@ -251,7 +260,7 @@ public class ReCodeItRemapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisplayEndBanner(string hollowedPath)
|
private void DisplayEndBanner(string hollowedPath = "", bool validate = false)
|
||||||
{
|
{
|
||||||
var failures = 0;
|
var failures = 0;
|
||||||
var changes = 0;
|
var changes = 0;
|
||||||
@ -294,9 +303,13 @@ public class ReCodeItRemapper
|
|||||||
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
||||||
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
||||||
Logger.Log($"Result renamed {changes} Types. Failed to rename {failures} Types", ConsoleColor.Green);
|
Logger.Log($"Result renamed {changes} Types. Failed to rename {failures} Types", ConsoleColor.Green);
|
||||||
Logger.Log($"Assembly written to `{OutPath}`", ConsoleColor.Green);
|
|
||||||
Logger.Log($"Hollowed written to `{hollowedPath}`", ConsoleColor.Green);
|
if (!validate)
|
||||||
Logger.Log($"Remap took {Stopwatch.Elapsed.TotalSeconds:F1} seconds", ConsoleColor.Green);
|
{
|
||||||
|
Logger.Log($"Assembly written to `{OutPath}`", ConsoleColor.Green);
|
||||||
|
Logger.Log($"Hollowed written to `{hollowedPath}`", ConsoleColor.Green);
|
||||||
|
Logger.Log($"Remap took {Stopwatch.Elapsed.TotalSeconds:F1} seconds", ConsoleColor.Green);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisplayAlternativeMatches(RemapModel remap)
|
private void DisplayAlternativeMatches(RemapModel remap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user