Make CLI update old type names, remove obsidian folder
This commit is contained in:
parent
8f1fdeadfd
commit
c9337cd98a
1
Obsidian Notes/ReCodeIt/.obsidian/app.json
vendored
1
Obsidian Notes/ReCodeIt/.obsidian/app.json
vendored
@ -1 +0,0 @@
|
|||||||
{}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"accentColor": ""
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
"file-explorer": true,
|
|
||||||
"global-search": true,
|
|
||||||
"switcher": true,
|
|
||||||
"graph": true,
|
|
||||||
"backlink": true,
|
|
||||||
"canvas": true,
|
|
||||||
"outgoing-link": true,
|
|
||||||
"tag-pane": true,
|
|
||||||
"properties": false,
|
|
||||||
"page-preview": true,
|
|
||||||
"daily-notes": true,
|
|
||||||
"templates": true,
|
|
||||||
"note-composer": true,
|
|
||||||
"command-palette": true,
|
|
||||||
"slash-command": false,
|
|
||||||
"editor-status": true,
|
|
||||||
"bookmarks": true,
|
|
||||||
"markdown-importer": false,
|
|
||||||
"zk-prefixer": false,
|
|
||||||
"random-note": false,
|
|
||||||
"outline": true,
|
|
||||||
"word-count": true,
|
|
||||||
"slides": false,
|
|
||||||
"audio-recorder": false,
|
|
||||||
"workspaces": false,
|
|
||||||
"file-recovery": true,
|
|
||||||
"publish": false,
|
|
||||||
"sync": false
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
[
|
|
||||||
"file-explorer",
|
|
||||||
"global-search",
|
|
||||||
"switcher",
|
|
||||||
"graph",
|
|
||||||
"backlink",
|
|
||||||
"canvas",
|
|
||||||
"outgoing-link",
|
|
||||||
"tag-pane",
|
|
||||||
"page-preview",
|
|
||||||
"daily-notes",
|
|
||||||
"templates",
|
|
||||||
"note-composer",
|
|
||||||
"command-palette",
|
|
||||||
"editor-status",
|
|
||||||
"bookmarks",
|
|
||||||
"outline",
|
|
||||||
"word-count",
|
|
||||||
"file-recovery"
|
|
||||||
]
|
|
22
Obsidian Notes/ReCodeIt/.obsidian/graph.json
vendored
22
Obsidian Notes/ReCodeIt/.obsidian/graph.json
vendored
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"collapse-filter": true,
|
|
||||||
"search": "",
|
|
||||||
"showTags": false,
|
|
||||||
"showAttachments": false,
|
|
||||||
"hideUnresolved": false,
|
|
||||||
"showOrphans": true,
|
|
||||||
"collapse-color-groups": true,
|
|
||||||
"colorGroups": [],
|
|
||||||
"collapse-display": true,
|
|
||||||
"showArrow": false,
|
|
||||||
"textFadeMultiplier": 0,
|
|
||||||
"nodeSizeMultiplier": 1,
|
|
||||||
"lineSizeMultiplier": 1,
|
|
||||||
"collapse-forces": true,
|
|
||||||
"centerStrength": 0.518713248970312,
|
|
||||||
"repelStrength": 10,
|
|
||||||
"linkStrength": 1,
|
|
||||||
"linkDistance": 250,
|
|
||||||
"scale": 1,
|
|
||||||
"close": true
|
|
||||||
}
|
|
158
Obsidian Notes/ReCodeIt/.obsidian/workspace.json
vendored
158
Obsidian Notes/ReCodeIt/.obsidian/workspace.json
vendored
@ -1,158 +0,0 @@
|
|||||||
{
|
|
||||||
"main": {
|
|
||||||
"id": "379217465f549fca",
|
|
||||||
"type": "split",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"id": "54c1949a2997d742",
|
|
||||||
"type": "tabs",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"id": "3ba51241806af7df",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "canvas",
|
|
||||||
"state": {
|
|
||||||
"file": "Untitled.canvas",
|
|
||||||
"viewState": {
|
|
||||||
"x": -1324.3333740234375,
|
|
||||||
"y": -365.66656494140625,
|
|
||||||
"zoom": -0.6666666666666666
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"direction": "vertical"
|
|
||||||
},
|
|
||||||
"left": {
|
|
||||||
"id": "5b6afcf2ac9987d1",
|
|
||||||
"type": "split",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"id": "633de3e685c77487",
|
|
||||||
"type": "tabs",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"id": "8890b3cf74fd4a96",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "file-explorer",
|
|
||||||
"state": {
|
|
||||||
"sortOrder": "alphabetical"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "7f4412dd886a7682",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "search",
|
|
||||||
"state": {
|
|
||||||
"query": "",
|
|
||||||
"matchingCase": false,
|
|
||||||
"explainSearch": false,
|
|
||||||
"collapseAll": false,
|
|
||||||
"extraContext": false,
|
|
||||||
"sortOrder": "alphabetical"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "5bda2ad3b0974edd",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "bookmarks",
|
|
||||||
"state": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"direction": "horizontal",
|
|
||||||
"width": 300
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
"id": "823dd02d5532773c",
|
|
||||||
"type": "split",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"id": "52bb8c1a37662004",
|
|
||||||
"type": "tabs",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"id": "16f0b64c50ad965f",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "backlink",
|
|
||||||
"state": {
|
|
||||||
"file": "Untitled.canvas",
|
|
||||||
"collapseAll": false,
|
|
||||||
"extraContext": false,
|
|
||||||
"sortOrder": "alphabetical",
|
|
||||||
"showSearch": false,
|
|
||||||
"searchQuery": "",
|
|
||||||
"backlinkCollapsed": false,
|
|
||||||
"unlinkedCollapsed": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "4cae092c09f416a0",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "outgoing-link",
|
|
||||||
"state": {
|
|
||||||
"file": "Untitled.canvas",
|
|
||||||
"linksCollapsed": false,
|
|
||||||
"unlinkedCollapsed": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "9ac3d05213c572e2",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "tag",
|
|
||||||
"state": {
|
|
||||||
"sortOrder": "frequency",
|
|
||||||
"useHierarchy": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "b92d0982927abb20",
|
|
||||||
"type": "leaf",
|
|
||||||
"state": {
|
|
||||||
"type": "outline",
|
|
||||||
"state": {
|
|
||||||
"file": "Untitled.canvas"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"direction": "horizontal",
|
|
||||||
"width": 300,
|
|
||||||
"collapsed": true
|
|
||||||
},
|
|
||||||
"left-ribbon": {
|
|
||||||
"hiddenItems": {
|
|
||||||
"switcher:Open quick switcher": false,
|
|
||||||
"graph:Open graph view": false,
|
|
||||||
"canvas:Create new canvas": false,
|
|
||||||
"daily-notes:Open today's daily note": false,
|
|
||||||
"templates:Insert template": false,
|
|
||||||
"command-palette:Open command palette": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"active": "3ba51241806af7df",
|
|
||||||
"lastOpenFiles": [
|
|
||||||
"Untitled.canvas",
|
|
||||||
"Untitled.md",
|
|
||||||
"Welcome.md"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"nodes":[
|
|
||||||
{"id":"02cecbc06ca4e27e","x":-2460,"y":-840,"width":680,"height":440,"type":"text","text":"Re-Mapper overhaul\n\n- More required parameters for better searches\n - Is Asbstract\n - Is Interface\n - Is Public"},
|
|
||||||
{"id":"ef843881ce9f25ca","x":-1410,"y":-680,"width":170,"height":60,"type":"text","text":"Is Abstract"},
|
|
||||||
{"id":"d0995cf4fa4e7306","x":-1194,"y":-840,"width":120,"height":60,"type":"text","text":"IsPublic"},
|
|
||||||
{"id":"ef16782e8346c662","type":"text","text":"Is Interface","x":-1208,"y":-676,"width":149,"height":56}
|
|
||||||
],
|
|
||||||
"edges":[
|
|
||||||
{"id":"3e2076115efebf6f","fromNode":"d0995cf4fa4e7306","fromSide":"bottom","toNode":"ef843881ce9f25ca","toSide":"top"},
|
|
||||||
{"id":"a7c1e1576f14002e","fromNode":"d0995cf4fa4e7306","fromSide":"bottom","toNode":"ef16782e8346c662","toSide":"top"}
|
|
||||||
]
|
|
||||||
}
|
|
@ -3,7 +3,6 @@ using CliFx.Attributes;
|
|||||||
using CliFx.Infrastructure;
|
using CliFx.Infrastructure;
|
||||||
using ReCodeIt.CrossCompiler;
|
using ReCodeIt.CrossCompiler;
|
||||||
using ReCodeIt.Utils;
|
using ReCodeIt.Utils;
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
namespace ReCodeIt.Commands;
|
namespace ReCodeIt.Commands;
|
||||||
|
|
||||||
@ -25,8 +24,6 @@ public class Build : ICommand
|
|||||||
|
|
||||||
if (isRemote) { return; }
|
if (isRemote) { return; }
|
||||||
|
|
||||||
await UseLastLoadedProject(console);
|
|
||||||
|
|
||||||
// Wait for log termination
|
// Wait for log termination
|
||||||
Logger.Terminate();
|
Logger.Terminate();
|
||||||
while(Logger.IsRunning()) {}
|
while(Logger.IsRunning()) {}
|
||||||
@ -78,34 +75,6 @@ public class Build : ICommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> UseLastLoadedProject(IConsole console)
|
|
||||||
{
|
|
||||||
if (RegistryHelper.GetRegistryValue<string>("LastLoadedProject") != null)
|
|
||||||
{
|
|
||||||
string currentDirectory = Directory.GetCurrentDirectory();
|
|
||||||
|
|
||||||
console.Output.WriteLine($"Project: {RegistryHelper.GetRegistryValue<string>("LastLoadedProject")}");
|
|
||||||
console.Output.WriteLine($"Working Dir: {currentDirectory}");
|
|
||||||
|
|
||||||
CrossCompiler = new();
|
|
||||||
|
|
||||||
DataProvider.LoadAppSettings();
|
|
||||||
DataProvider.IsCli = true;
|
|
||||||
|
|
||||||
ProjectManager.LoadProject(RegistryHelper.GetRegistryValue<string>("LastLoadedProject"), true);
|
|
||||||
|
|
||||||
if (!Validate(console)) { return false; }
|
|
||||||
|
|
||||||
await CrossCompiler.StartCrossCompile();
|
|
||||||
|
|
||||||
DataProvider.SaveAppSettings();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool Validate(IConsole console)
|
private bool Validate(IConsole console)
|
||||||
{
|
{
|
||||||
if (ProjectManager.ActiveProject == null)
|
if (ProjectManager.ActiveProject == null)
|
||||||
|
@ -3,7 +3,6 @@ using CliFx.Attributes;
|
|||||||
using CliFx.Infrastructure;
|
using CliFx.Infrastructure;
|
||||||
using ReCodeIt.CrossCompiler;
|
using ReCodeIt.CrossCompiler;
|
||||||
using ReCodeIt.Utils;
|
using ReCodeIt.Utils;
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
namespace ReCodeIt.Commands;
|
namespace ReCodeIt.Commands;
|
||||||
|
|
||||||
@ -14,16 +13,14 @@ public class BuildRef : ICommand
|
|||||||
|
|
||||||
public ValueTask ExecuteAsync(IConsole console)
|
public ValueTask ExecuteAsync(IConsole console)
|
||||||
{
|
{
|
||||||
console.Output.WriteLine(RegistryHelper.GetRegistryValue<string>("LastLoadedProject"));
|
if (DataProvider.Settings.CrossCompiler.LastLoadedProject != null)
|
||||||
|
|
||||||
if (RegistryHelper.GetRegistryValue<string>("LastLoadedProject") != null)
|
|
||||||
{
|
{
|
||||||
CrossCompiler = new();
|
CrossCompiler = new();
|
||||||
|
|
||||||
DataProvider.LoadAppSettings();
|
DataProvider.LoadAppSettings();
|
||||||
DataProvider.IsCli = true;
|
DataProvider.IsCli = true;
|
||||||
|
|
||||||
ProjectManager.LoadProject(RegistryHelper.GetRegistryValue<string>("LastLoadedProject"), true);
|
ProjectManager.LoadProject(DataProvider.Settings.CrossCompiler.LastLoadedProject);
|
||||||
|
|
||||||
if (!Validate(console)) { return default; }
|
if (!Validate(console)) { return default; }
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ public class ReMap : ICommand
|
|||||||
|
|
||||||
public ValueTask ExecuteAsync(IConsole console)
|
public ValueTask ExecuteAsync(IConsole console)
|
||||||
{
|
{
|
||||||
DataProvider.IsCli = true;
|
|
||||||
DataProvider.LoadAppSettings();
|
DataProvider.LoadAppSettings();
|
||||||
|
DataProvider.Settings.Remapper.MappingPath = MappingJsonPath;
|
||||||
|
|
||||||
var remapperSettings = DataProvider.Settings.Remapper.MappingSettings;
|
var remapperSettings = DataProvider.Settings.Remapper.MappingSettings;
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="xcopy "$(SolutionDir)Templates" "$(TargetDir)Data" /E /I /Y" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\RecodeItLib\ReCodeItLib.csproj" />
|
<ProjectReference Include="..\RecodeItLib\ReCodeItLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1093,6 +1093,12 @@ public partial class ReCodeItForm : Form
|
|||||||
|
|
||||||
private void CrossPatchRunButton_Click(object sender, EventArgs e)
|
private void CrossPatchRunButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (CrossCompiler.ActiveProject == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("No project is loaded");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (CrossCompiler.ActiveProject.RemapModels.Count == 0)
|
if (CrossCompiler.ActiveProject.RemapModels.Count == 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show("You cannot compile without having created remaps first");
|
MessageBox.Show("You cannot compile without having created remaps first");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using ReCodeIt.GUI;
|
using ReCodeIt.GUI;
|
||||||
using ReCodeIt.Utils;
|
using ReCodeIt.Utils;
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
namespace ReCodeIt;
|
namespace ReCodeIt;
|
||||||
|
|
||||||
@ -13,21 +12,6 @@ internal static class Program
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
private static void Main()
|
private static void Main()
|
||||||
{
|
{
|
||||||
RegistryHelper.SetRegistryValue(
|
|
||||||
"DataPath",
|
|
||||||
DataProvider.DataPath,
|
|
||||||
RegistryValueKind.String);
|
|
||||||
|
|
||||||
RegistryHelper.SetRegistryValue(
|
|
||||||
"SettingsPath",
|
|
||||||
Path.Combine(DataProvider.DataPath, "Settings.jsonc"),
|
|
||||||
RegistryValueKind.String);
|
|
||||||
|
|
||||||
RegistryHelper.SetRegistryValue(
|
|
||||||
"LogPath",
|
|
||||||
Path.Combine(DataProvider.DataPath, "Log.log"),
|
|
||||||
RegistryValueKind.String);
|
|
||||||
|
|
||||||
DataProvider.LoadAppSettings();
|
DataProvider.LoadAppSettings();
|
||||||
|
|
||||||
// To customize application configuration such as set high DPI settings or default font, see https://aka.ms/applicationconfiguration.
|
// To customize application configuration such as set high DPI settings or default font, see https://aka.ms/applicationconfiguration.
|
||||||
|
@ -3,7 +3,6 @@ using Microsoft.Win32;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using ReCodeIt.Models;
|
using ReCodeIt.Models;
|
||||||
using ReCodeIt.Utils;
|
using ReCodeIt.Utils;
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
namespace ReCodeIt.CrossCompiler;
|
namespace ReCodeIt.CrossCompiler;
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ public static class ProjectManager
|
|||||||
|
|
||||||
DataProvider.Settings.CrossCompiler.LastLoadedProject = path;
|
DataProvider.Settings.CrossCompiler.LastLoadedProject = path;
|
||||||
|
|
||||||
RegistryHelper.SetRegistryValue("LastLoadedProject", path, RegistryValueKind.String);
|
|
||||||
DataProvider.SaveAppSettings();
|
DataProvider.SaveAppSettings();
|
||||||
|
|
||||||
Logger.Log($"Cross Compiler project json saved to {path}", ConsoleColor.Green);
|
Logger.Log($"Cross Compiler project json saved to {path}", ConsoleColor.Green);
|
||||||
@ -107,7 +105,6 @@ public static class ProjectManager
|
|||||||
DataProvider.Settings.CrossCompiler.LastLoadedProject = path;
|
DataProvider.Settings.CrossCompiler.LastLoadedProject = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegistryHelper.SetRegistryValue("LastLoadedProject", path, RegistryValueKind.String);
|
|
||||||
DataProvider.SaveAppSettings();
|
DataProvider.SaveAppSettings();
|
||||||
|
|
||||||
Logger.Log($"Loaded Cross Compiler Project: {model?.VisualStudioSolutionDirectoryPath}");
|
Logger.Log($"Loaded Cross Compiler Project: {model?.VisualStudioSolutionDirectoryPath}");
|
||||||
|
@ -69,12 +69,6 @@ public class ReCodeItCrossCompiler
|
|||||||
{
|
{
|
||||||
newProject = solution.GetProject(projId);
|
newProject = solution.GetProject(projId);
|
||||||
|
|
||||||
// Skip the ReCodeIt project if it exists
|
|
||||||
if (newProject!.Name == "ReCodeIt")
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.Log("Reversing Identifier Changes...", ConsoleColor.Yellow);
|
Logger.Log("Reversing Identifier Changes...", ConsoleColor.Yellow);
|
||||||
|
|
||||||
foreach (var docId in newProject.DocumentIds)
|
foreach (var docId in newProject.DocumentIds)
|
||||||
@ -96,10 +90,35 @@ public class ReCodeItCrossCompiler
|
|||||||
newProject = newDoc.Project;
|
newProject = newDoc.Project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newProject = ChangeReferencePath(newProject);
|
||||||
|
|
||||||
await CompileProject(newProject);
|
await CompileProject(newProject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Project ChangeReferencePath(Project project)
|
||||||
|
{
|
||||||
|
foreach (var reference in project.MetadataReferences)
|
||||||
|
{
|
||||||
|
Logger.Log(reference.Display);
|
||||||
|
|
||||||
|
if (reference.Display.Contains(ActiveProject.OriginalAssemblyDllName))
|
||||||
|
{
|
||||||
|
Logger.Log("Removing old reference...", ConsoleColor.Yellow);
|
||||||
|
|
||||||
|
// Remove the reference from the project
|
||||||
|
project = project.RemoveMetadataReference(reference);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.Log("Creating new reference...", ConsoleColor.Yellow);
|
||||||
|
var newRef = MetadataReference.CreateFromFile(ActiveProject.OriginalAssemblyPath);
|
||||||
|
project = project.AddMetadataReference(newRef);
|
||||||
|
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
private async Task CompileProject(Project project)
|
private async Task CompileProject(Project project)
|
||||||
{
|
{
|
||||||
Logger.Log("Compiling Project...", ConsoleColor.Yellow);
|
Logger.Log("Compiling Project...", ConsoleColor.Yellow);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
using dnlib.DotNet;
|
using dnlib.DotNet;
|
||||||
using dnlib.DotNet.Emit;
|
using dnlib.DotNet.Emit;
|
||||||
using ReCodeIt.CrossCompiler;
|
using ReCodeIt.CrossCompiler;
|
||||||
|
using ReCodeIt.Enums;
|
||||||
using ReCodeIt.Models;
|
using ReCodeIt.Models;
|
||||||
using ReCodeIt.ReMapper.Search;
|
using ReCodeIt.ReMapper.Search;
|
||||||
using ReCodeIt.Utils;
|
using ReCodeIt.Utils;
|
||||||
using ReCodeItLib.Remapper.Search;
|
using ReCodeItLib.Remapper.Search;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using ReCodeIt.Enums;
|
|
||||||
|
|
||||||
namespace ReCodeIt.ReMapper;
|
namespace ReCodeIt.ReMapper;
|
||||||
|
|
||||||
@ -141,7 +141,6 @@ public class ReCodeItRemapper
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +153,12 @@ public class ReCodeItRemapper
|
|||||||
{
|
{
|
||||||
var tokens = DataProvider.Settings.AutoMapper.TokensToMatch;
|
var tokens = DataProvider.Settings.AutoMapper.TokensToMatch;
|
||||||
|
|
||||||
|
if (mapping.UseForceRename)
|
||||||
|
{
|
||||||
|
HandleDirectRename(mapping, types);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mapping.SearchParams.IsNested is false or null)
|
if (mapping.SearchParams.IsNested is false or null)
|
||||||
{
|
{
|
||||||
types = types.Where(type => tokens.Any(token => type.Name.StartsWith(token)));
|
types = types.Where(type => tokens.Any(token => type.Name.StartsWith(token)));
|
||||||
@ -196,6 +201,28 @@ public class ReCodeItRemapper
|
|||||||
mapping.TypeCandidates.UnionWith(types);
|
mapping.TypeCandidates.UnionWith(types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleDirectRename(RemapModel mapping, IEnumerable<TypeDef> types)
|
||||||
|
{
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
if (type.Name == mapping.OriginalTypeName)
|
||||||
|
{
|
||||||
|
mapping.TypePrimeCandidate = type;
|
||||||
|
mapping.OriginalTypeName = type.Name.String;
|
||||||
|
mapping.Succeeded = true;
|
||||||
|
|
||||||
|
_alreadyGivenNames.Add(mapping.OriginalTypeName);
|
||||||
|
|
||||||
|
if (CrossMapMode)
|
||||||
|
{// Store the original types for caching
|
||||||
|
_compiler.ActiveProject.ChangedTypes.Add(mapping.NewTypeName, mapping.OriginalTypeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Choose the best possible match from all remaps
|
/// Choose the best possible match from all remaps
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -213,7 +240,7 @@ public class ReCodeItRemapper
|
|||||||
/// <param name="remap"></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 || remap.Succeeded) { return; }
|
||||||
|
|
||||||
var winner = remap.TypeCandidates.FirstOrDefault();
|
var winner = remap.TypeCandidates.FirstOrDefault();
|
||||||
remap.TypePrimeCandidate = winner;
|
remap.TypePrimeCandidate = winner;
|
||||||
@ -230,7 +257,7 @@ public class ReCodeItRemapper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alreadyGivenNames.Add(winner.FullName);
|
_alreadyGivenNames.Add(remap.OriginalTypeName);
|
||||||
|
|
||||||
remap.Succeeded = true;
|
remap.Succeeded = true;
|
||||||
|
|
||||||
@ -238,7 +265,7 @@ public class ReCodeItRemapper
|
|||||||
|
|
||||||
if (CrossMapMode)
|
if (CrossMapMode)
|
||||||
{// Store the original types for caching
|
{// Store the original types for caching
|
||||||
//_compiler.ActiveProject.ChangedTypes.Add(highestScore.ProposedNewName, highestScore.Definition.Name);
|
_compiler.ActiveProject.ChangedTypes.Add(winner.Name.String, remap.OriginalTypeName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +275,10 @@ public class ReCodeItRemapper
|
|||||||
private void WriteAssembly()
|
private void WriteAssembly()
|
||||||
{
|
{
|
||||||
var moduleName = Module.Name;
|
var moduleName = Module.Name;
|
||||||
moduleName = moduleName.Replace(".dll", "-Remapped.dll");
|
|
||||||
|
moduleName = CrossMapMode
|
||||||
|
? moduleName
|
||||||
|
: moduleName.Replace(".dll", "-Remapped.dll");
|
||||||
|
|
||||||
OutPath = Path.Combine(OutPath, moduleName);
|
OutPath = Path.Combine(OutPath, moduleName);
|
||||||
|
|
||||||
@ -262,6 +292,8 @@ public class ReCodeItRemapper
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CrossMapMode)
|
||||||
|
{
|
||||||
Logger.Log("Creating Hollow...", ConsoleColor.Yellow);
|
Logger.Log("Creating Hollow...", ConsoleColor.Yellow);
|
||||||
Hollow();
|
Hollow();
|
||||||
|
|
||||||
@ -270,6 +302,7 @@ public class ReCodeItRemapper
|
|||||||
Module.Write(hollowedPath);
|
Module.Write(hollowedPath);
|
||||||
|
|
||||||
DisplayEndBanner(hollowedPath);
|
DisplayEndBanner(hollowedPath);
|
||||||
|
}
|
||||||
|
|
||||||
if (DataProvider.Settings.Remapper.MappingPath != string.Empty)
|
if (DataProvider.Settings.Remapper.MappingPath != string.Empty)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using dnlib.DotNet;
|
using dnlib.DotNet;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using ReCodeIt.Models;
|
using ReCodeIt.Models;
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
namespace ReCodeIt.Utils;
|
namespace ReCodeIt.Utils;
|
||||||
|
|
||||||
@ -30,12 +29,6 @@ public static class DataProvider
|
|||||||
|
|
||||||
public static void LoadAppSettings()
|
public static void LoadAppSettings()
|
||||||
{
|
{
|
||||||
if (IsCli)
|
|
||||||
{
|
|
||||||
Settings = CreateFakeSettings();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var settingsPath = Path.Combine(DataPath, "Settings.jsonc");
|
var settingsPath = Path.Combine(DataPath, "Settings.jsonc");
|
||||||
|
|
||||||
var jsonText = File.ReadAllText(settingsPath);
|
var jsonText = File.ReadAllText(settingsPath);
|
||||||
@ -47,13 +40,6 @@ public static class DataProvider
|
|||||||
|
|
||||||
Settings = JsonConvert.DeserializeObject<Settings>(jsonText, settings);
|
Settings = JsonConvert.DeserializeObject<Settings>(jsonText, settings);
|
||||||
|
|
||||||
if (Settings is null)
|
|
||||||
{
|
|
||||||
Logger.Log("Settings were null, creating new settings", ConsoleColor.Red);
|
|
||||||
Settings = CreateFakeSettings();
|
|
||||||
SaveAppSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.Log($"Settings loaded from '{settingsPath}'");
|
Logger.Log($"Settings loaded from '{settingsPath}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +47,7 @@ public static class DataProvider
|
|||||||
{
|
{
|
||||||
if (IsCli) { return; }
|
if (IsCli) { return; }
|
||||||
|
|
||||||
var settingsPath = RegistryHelper.GetRegistryValue<string>("SettingsPath");
|
var settingsPath = Path.Combine(DataPath, "Settings.jsonc");
|
||||||
|
|
||||||
if (!File.Exists(settingsPath))
|
if (!File.Exists(settingsPath))
|
||||||
{
|
{
|
||||||
@ -150,91 +136,4 @@ public static class DataProvider
|
|||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Settings CreateFakeSettings()
|
|
||||||
{
|
|
||||||
var settings = new Settings
|
|
||||||
{
|
|
||||||
AppSettings = new AppSettings
|
|
||||||
{
|
|
||||||
Debug = false,
|
|
||||||
SilentMode = true
|
|
||||||
},
|
|
||||||
Remapper = new RemapperSettings
|
|
||||||
{
|
|
||||||
MappingPath = string.Empty,
|
|
||||||
OutputPath = string.Empty,
|
|
||||||
UseProjectMappings = false,
|
|
||||||
MappingSettings = new MappingSettings
|
|
||||||
{
|
|
||||||
RenameFields = false,
|
|
||||||
RenameProperties = false,
|
|
||||||
Publicize = false,
|
|
||||||
Unseal = false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
AutoMapper = new AutoMapperSettings
|
|
||||||
{
|
|
||||||
AssemblyPath = string.Empty,
|
|
||||||
OutputPath = string.Empty,
|
|
||||||
RequiredMatches = 5,
|
|
||||||
MinLengthToMatch = 7,
|
|
||||||
SearchMethods = true,
|
|
||||||
MappingSettings = new MappingSettings
|
|
||||||
{
|
|
||||||
RenameFields = false,
|
|
||||||
RenameProperties = false,
|
|
||||||
Publicize = false,
|
|
||||||
Unseal = false,
|
|
||||||
},
|
|
||||||
TypesToIgnore = [
|
|
||||||
"Boolean",
|
|
||||||
"List",
|
|
||||||
"Dictionary",
|
|
||||||
"Byte",
|
|
||||||
"Int16",
|
|
||||||
"Int32",
|
|
||||||
"Func",
|
|
||||||
"Action",
|
|
||||||
"Object",
|
|
||||||
"String",
|
|
||||||
"Vector2",
|
|
||||||
"Vector3",
|
|
||||||
"Vector4",
|
|
||||||
"Stream",
|
|
||||||
"HashSet",
|
|
||||||
"Double",
|
|
||||||
"IEnumerator"
|
|
||||||
],
|
|
||||||
TokensToMatch = [
|
|
||||||
"Class",
|
|
||||||
"GClass",
|
|
||||||
"GStruct",
|
|
||||||
"Interface",
|
|
||||||
"GInterface"
|
|
||||||
],
|
|
||||||
PropertyFieldBlackList = [
|
|
||||||
"Columns",
|
|
||||||
"mColumns",
|
|
||||||
"Template",
|
|
||||||
"Condition",
|
|
||||||
"Conditions",
|
|
||||||
"Counter",
|
|
||||||
"Instance",
|
|
||||||
"Command",
|
|
||||||
"_template"
|
|
||||||
],
|
|
||||||
MethodParamaterBlackList = [
|
|
||||||
|
|
||||||
],
|
|
||||||
},
|
|
||||||
CrossCompiler = new CrossCompilerSettings
|
|
||||||
{
|
|
||||||
LastLoadedProject = string.Empty,
|
|
||||||
AutoLoadLastActiveProject = true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
namespace ReCodeIt.Utils;
|
namespace ReCodeIt.Utils;
|
||||||
|
|
||||||
@ -85,8 +84,7 @@ public static class Logger
|
|||||||
}
|
}
|
||||||
|
|
||||||
private const string _defaultFileName = "ReCodeIt.log";
|
private const string _defaultFileName = "ReCodeIt.log";
|
||||||
private static string _logPath => RegistryHelper.GetRegistryValue<string>("LogPath") ?? $"{AppDomain.CurrentDomain.BaseDirectory}{_defaultFileName}";
|
private static string _logPath => Path.Combine(AppContext.BaseDirectory, "Data", "Settings.jsonc");
|
||||||
|
|
||||||
public static void ClearLog()
|
public static void ClearLog()
|
||||||
{
|
{
|
||||||
if (File.Exists(_logPath))
|
if (File.Exists(_logPath))
|
||||||
@ -110,7 +108,7 @@ public static class Logger
|
|||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToDisk(message.Message);
|
//WriteToDisk(message.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteToDisk(object message)
|
private static void WriteToDisk(object message)
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
namespace ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
public static class RegistryHelper
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Sets a key in the registry, given its key, value, and kind
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
/// <param name="kind"></param>
|
|
||||||
public static void SetRegistryValue(string key, string value, RegistryValueKind kind)
|
|
||||||
{
|
|
||||||
var regKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\ReCodeIt");
|
|
||||||
|
|
||||||
regKey.SetValue(key, value, kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a key from the registry, given its key and type
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <param name="key"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static T? GetRegistryValue<T>(string key)
|
|
||||||
{
|
|
||||||
var regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\ReCodeIt");
|
|
||||||
return (T)regKey?.GetValue(key);
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,9 +4,9 @@
|
|||||||
"SilentMode": true
|
"SilentMode": true
|
||||||
},
|
},
|
||||||
"Remapper": {
|
"Remapper": {
|
||||||
"AssemblyPath": "G:\\development\\ReCodeIt\\RecodeItGUI\\bin\\Debug\\net8.0-windows\\Data\\Managed\\Assembly-CSharp-cleaned.dll",
|
"AssemblyPath": "",
|
||||||
"OutputPath": "G:\\development\\ReCodeIt\\RecodeItGUI\\bin\\Debug\\net8.0-windows\\Data",
|
"OutputPath": "",
|
||||||
"MappingPath": "G:\\development\\ReCodeIt\\RecodeItGUI\\bin\\Debug\\net8.0-windows\\Data\\Mappings.jsonc",
|
"MappingPath": "",
|
||||||
"UseProjectMappings": false,
|
"UseProjectMappings": false,
|
||||||
"MappingSettings": {
|
"MappingSettings": {
|
||||||
"RenameFields": true,
|
"RenameFields": true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user