diff --git a/Obsidian Notes/ReCodeIt/.obsidian/app.json b/Obsidian Notes/ReCodeIt/.obsidian/app.json deleted file mode 100644 index 9e26dfe..0000000 --- a/Obsidian Notes/ReCodeIt/.obsidian/app.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/Obsidian Notes/ReCodeIt/.obsidian/appearance.json b/Obsidian Notes/ReCodeIt/.obsidian/appearance.json deleted file mode 100644 index c8c365d..0000000 --- a/Obsidian Notes/ReCodeIt/.obsidian/appearance.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "accentColor": "" -} \ No newline at end of file diff --git a/Obsidian Notes/ReCodeIt/.obsidian/core-plugins-migration.json b/Obsidian Notes/ReCodeIt/.obsidian/core-plugins-migration.json deleted file mode 100644 index 436f43c..0000000 --- a/Obsidian Notes/ReCodeIt/.obsidian/core-plugins-migration.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/Obsidian Notes/ReCodeIt/.obsidian/core-plugins.json b/Obsidian Notes/ReCodeIt/.obsidian/core-plugins.json deleted file mode 100644 index 9405bfd..0000000 --- a/Obsidian Notes/ReCodeIt/.obsidian/core-plugins.json +++ /dev/null @@ -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" -] \ No newline at end of file diff --git a/Obsidian Notes/ReCodeIt/.obsidian/graph.json b/Obsidian Notes/ReCodeIt/.obsidian/graph.json deleted file mode 100644 index 42a46ec..0000000 --- a/Obsidian Notes/ReCodeIt/.obsidian/graph.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/Obsidian Notes/ReCodeIt/.obsidian/workspace.json b/Obsidian Notes/ReCodeIt/.obsidian/workspace.json deleted file mode 100644 index 3fd305c..0000000 --- a/Obsidian Notes/ReCodeIt/.obsidian/workspace.json +++ /dev/null @@ -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" - ] -} \ No newline at end of file diff --git a/Obsidian Notes/ReCodeIt/Untitled.canvas b/Obsidian Notes/ReCodeIt/Untitled.canvas deleted file mode 100644 index b3929ea..0000000 --- a/Obsidian Notes/ReCodeIt/Untitled.canvas +++ /dev/null @@ -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"} - ] -} \ No newline at end of file diff --git a/Obsidian Notes/ReCodeIt/Untitled.md b/Obsidian Notes/ReCodeIt/Untitled.md deleted file mode 100644 index e69de29..0000000 diff --git a/ReCodeItCLI/Commands/Build.cs b/ReCodeItCLI/Commands/Build.cs index 0cd9def..e60d2a8 100644 --- a/ReCodeItCLI/Commands/Build.cs +++ b/ReCodeItCLI/Commands/Build.cs @@ -3,7 +3,6 @@ using CliFx.Attributes; using CliFx.Infrastructure; using ReCodeIt.CrossCompiler; using ReCodeIt.Utils; -using ReCodeItLib.Utils; namespace ReCodeIt.Commands; @@ -24,8 +23,6 @@ public class Build : ICommand var isRemote = await UseRemoteProject(console); if (isRemote) { return; } - - await UseLastLoadedProject(console); // Wait for log termination Logger.Terminate(); @@ -77,35 +74,7 @@ public class Build : ICommand return false; } - - private async Task UseLastLoadedProject(IConsole console) - { - if (RegistryHelper.GetRegistryValue("LastLoadedProject") != null) - { - string currentDirectory = Directory.GetCurrentDirectory(); - - console.Output.WriteLine($"Project: {RegistryHelper.GetRegistryValue("LastLoadedProject")}"); - console.Output.WriteLine($"Working Dir: {currentDirectory}"); - - CrossCompiler = new(); - - DataProvider.LoadAppSettings(); - DataProvider.IsCli = true; - - ProjectManager.LoadProject(RegistryHelper.GetRegistryValue("LastLoadedProject"), true); - - if (!Validate(console)) { return false; } - - await CrossCompiler.StartCrossCompile(); - - DataProvider.SaveAppSettings(); - - return true; - } - - return false; - } - + private bool Validate(IConsole console) { if (ProjectManager.ActiveProject == null) diff --git a/ReCodeItCLI/Commands/BuildRef.cs b/ReCodeItCLI/Commands/BuildRef.cs index 063b3e5..b6b1d26 100644 --- a/ReCodeItCLI/Commands/BuildRef.cs +++ b/ReCodeItCLI/Commands/BuildRef.cs @@ -3,7 +3,6 @@ using CliFx.Attributes; using CliFx.Infrastructure; using ReCodeIt.CrossCompiler; using ReCodeIt.Utils; -using ReCodeItLib.Utils; namespace ReCodeIt.Commands; @@ -14,16 +13,14 @@ public class BuildRef : ICommand public ValueTask ExecuteAsync(IConsole console) { - console.Output.WriteLine(RegistryHelper.GetRegistryValue("LastLoadedProject")); - - if (RegistryHelper.GetRegistryValue("LastLoadedProject") != null) + if (DataProvider.Settings.CrossCompiler.LastLoadedProject != null) { CrossCompiler = new(); DataProvider.LoadAppSettings(); DataProvider.IsCli = true; - ProjectManager.LoadProject(RegistryHelper.GetRegistryValue("LastLoadedProject"), true); + ProjectManager.LoadProject(DataProvider.Settings.CrossCompiler.LastLoadedProject); if (!Validate(console)) { return default; } diff --git a/ReCodeItCLI/Commands/ReMap.cs b/ReCodeItCLI/Commands/ReMap.cs index 6f6c711..9ce5d36 100644 --- a/ReCodeItCLI/Commands/ReMap.cs +++ b/ReCodeItCLI/Commands/ReMap.cs @@ -25,9 +25,9 @@ public class ReMap : ICommand public ValueTask ExecuteAsync(IConsole console) { - DataProvider.IsCli = true; DataProvider.LoadAppSettings(); - + DataProvider.Settings.Remapper.MappingPath = MappingJsonPath; + var remapperSettings = DataProvider.Settings.Remapper.MappingSettings; remapperSettings.RenameFields = ReName ?? false; diff --git a/ReCodeItCLI/ReCodeIt.csproj b/ReCodeItCLI/ReCodeIt.csproj index 0b3430d..63cab26 100644 --- a/ReCodeItCLI/ReCodeIt.csproj +++ b/ReCodeItCLI/ReCodeIt.csproj @@ -8,6 +8,10 @@ enable + + + + diff --git a/RecodeItGUI/GUI/Main.cs b/RecodeItGUI/GUI/Main.cs index d3ad16a..725a7ac 100644 --- a/RecodeItGUI/GUI/Main.cs +++ b/RecodeItGUI/GUI/Main.cs @@ -1093,6 +1093,12 @@ public partial class ReCodeItForm : Form 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) { MessageBox.Show("You cannot compile without having created remaps first"); diff --git a/RecodeItGUI/Program.cs b/RecodeItGUI/Program.cs index a077f3f..fc4af83 100644 --- a/RecodeItGUI/Program.cs +++ b/RecodeItGUI/Program.cs @@ -1,7 +1,6 @@ using Microsoft.Win32; using ReCodeIt.GUI; using ReCodeIt.Utils; -using ReCodeItLib.Utils; namespace ReCodeIt; @@ -13,21 +12,6 @@ internal static class Program [STAThread] 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(); // To customize application configuration such as set high DPI settings or default font, see https://aka.ms/applicationconfiguration. diff --git a/RecodeItLib/CrossCompiler/ProjectManager.cs b/RecodeItLib/CrossCompiler/ProjectManager.cs index 0881c03..1de129d 100644 --- a/RecodeItLib/CrossCompiler/ProjectManager.cs +++ b/RecodeItLib/CrossCompiler/ProjectManager.cs @@ -3,7 +3,6 @@ using Microsoft.Win32; using Newtonsoft.Json; using ReCodeIt.Models; using ReCodeIt.Utils; -using ReCodeItLib.Utils; namespace ReCodeIt.CrossCompiler; @@ -67,8 +66,7 @@ public static class ProjectManager File.WriteAllText(path, jsonText); DataProvider.Settings.CrossCompiler.LastLoadedProject = path; - - RegistryHelper.SetRegistryValue("LastLoadedProject", path, RegistryValueKind.String); + DataProvider.SaveAppSettings(); Logger.Log($"Cross Compiler project json saved to {path}", ConsoleColor.Green); @@ -106,8 +104,7 @@ public static class ProjectManager { DataProvider.Settings.CrossCompiler.LastLoadedProject = path; } - - RegistryHelper.SetRegistryValue("LastLoadedProject", path, RegistryValueKind.String); + DataProvider.SaveAppSettings(); Logger.Log($"Loaded Cross Compiler Project: {model?.VisualStudioSolutionDirectoryPath}"); diff --git a/RecodeItLib/CrossCompiler/ReCodeItCrossCompiler.cs b/RecodeItLib/CrossCompiler/ReCodeItCrossCompiler.cs index 19b2db4..217a002 100644 --- a/RecodeItLib/CrossCompiler/ReCodeItCrossCompiler.cs +++ b/RecodeItLib/CrossCompiler/ReCodeItCrossCompiler.cs @@ -69,12 +69,6 @@ public class ReCodeItCrossCompiler { newProject = solution.GetProject(projId); - // Skip the ReCodeIt project if it exists - if (newProject!.Name == "ReCodeIt") - { - continue; - } - Logger.Log("Reversing Identifier Changes...", ConsoleColor.Yellow); foreach (var docId in newProject.DocumentIds) @@ -96,10 +90,35 @@ public class ReCodeItCrossCompiler newProject = newDoc.Project; } + newProject = ChangeReferencePath(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) { Logger.Log("Compiling Project...", ConsoleColor.Yellow); diff --git a/RecodeItLib/Remapper/ReCodeItRemapper.cs b/RecodeItLib/Remapper/ReCodeItRemapper.cs index c5b2f8b..8989366 100644 --- a/RecodeItLib/Remapper/ReCodeItRemapper.cs +++ b/RecodeItLib/Remapper/ReCodeItRemapper.cs @@ -1,12 +1,12 @@ using dnlib.DotNet; using dnlib.DotNet.Emit; using ReCodeIt.CrossCompiler; +using ReCodeIt.Enums; using ReCodeIt.Models; using ReCodeIt.ReMapper.Search; using ReCodeIt.Utils; using ReCodeItLib.Remapper.Search; using System.Diagnostics; -using ReCodeIt.Enums; namespace ReCodeIt.ReMapper; @@ -64,12 +64,12 @@ public class ReCodeItRemapper OutPath = outPath; if (!Validate(_remaps)) return; - + IsRunning = true; Stopwatch.Start(); var types = Module.GetTypes(); - + var tasks = new List(remapModels.Count); foreach (var remap in remapModels) { @@ -137,14 +137,13 @@ public class ReCodeItRemapper var duplicateNewTypeName = duplicate.Key; Logger.Log($"Ambiguous NewTypeName: {duplicateNewTypeName} found. Cancelling Remap.", ConsoleColor.Red); } - + return false; } - return true; } - + /// /// First we filter our type collection based on simple search parameters (true/false/null) /// where null is a third disabled state. Then we score the types based on the search parameters @@ -154,6 +153,12 @@ public class ReCodeItRemapper { var tokens = DataProvider.Settings.AutoMapper.TokensToMatch; + if (mapping.UseForceRename) + { + HandleDirectRename(mapping, types); + return; + } + if (mapping.SearchParams.IsNested is false or null) { types = types.Where(type => tokens.Any(token => type.Name.StartsWith(token))); @@ -196,6 +201,28 @@ public class ReCodeItRemapper mapping.TypeCandidates.UnionWith(types); } + private void HandleDirectRename(RemapModel mapping, IEnumerable 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; + } + } + } + /// /// Choose the best possible match from all remaps /// @@ -213,12 +240,12 @@ public class ReCodeItRemapper /// private void ChooseBestMatch(RemapModel remap) { - if (remap.TypeCandidates.Count == 0) { return; } + if (remap.TypeCandidates.Count == 0 || remap.Succeeded) { return; } var winner = remap.TypeCandidates.FirstOrDefault(); remap.TypePrimeCandidate = winner; remap.OriginalTypeName = winner.Name.String; - + if (winner is null) { return; } if (_alreadyGivenNames.Contains(winner.FullName)) @@ -226,19 +253,19 @@ public class ReCodeItRemapper remap.NoMatchReasons.Add(ENoMatchReason.AmbiguousWithPreviousMatch); remap.AmbiguousTypeMatch = winner.FullName; remap.Succeeded = false; - + return; } - - _alreadyGivenNames.Add(winner.FullName); - + + _alreadyGivenNames.Add(remap.OriginalTypeName); + remap.Succeeded = true; remap.OriginalTypeName = winner.Name.String; if (CrossMapMode) {// 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() { var moduleName = Module.Name; - moduleName = moduleName.Replace(".dll", "-Remapped.dll"); + + moduleName = CrossMapMode + ? moduleName + : moduleName.Replace(".dll", "-Remapped.dll"); OutPath = Path.Combine(OutPath, moduleName); @@ -262,14 +292,17 @@ public class ReCodeItRemapper throw; } - Logger.Log("Creating Hollow...", ConsoleColor.Yellow); - Hollow(); + if (!CrossMapMode) + { + Logger.Log("Creating Hollow...", ConsoleColor.Yellow); + Hollow(); - var hollowedDir = Path.GetDirectoryName(OutPath); - var hollowedPath = Path.Combine(hollowedDir, "Hollowed.dll"); - Module.Write(hollowedPath); + var hollowedDir = Path.GetDirectoryName(OutPath); + var hollowedPath = Path.Combine(hollowedDir, "Hollowed.dll"); + Module.Write(hollowedPath); - DisplayEndBanner(hollowedPath); + DisplayEndBanner(hollowedPath); + } if (DataProvider.Settings.Remapper.MappingPath != string.Empty) { @@ -278,7 +311,7 @@ public class ReCodeItRemapper Stopwatch.Reset(); Module = null; - + IsRunning = false; OnComplete?.Invoke(); } @@ -304,10 +337,10 @@ public class ReCodeItRemapper { var failures = 0; var changes = 0; - + Logger.Log("-----------------------------------------------", ConsoleColor.Green); Logger.Log("-----------------------------------------------", ConsoleColor.Green); - + foreach (var remap in _remaps) { if (remap.Succeeded is false) { continue; } @@ -319,7 +352,7 @@ public class ReCodeItRemapper DisplayAlternativeMatches(remap); } - + foreach (var remap in _remaps) { if (remap.Succeeded is false && remap.NoMatchReasons.Contains(ENoMatchReason.AmbiguousWithPreviousMatch)) @@ -344,14 +377,14 @@ public class ReCodeItRemapper failures++; continue; } - + changes++; } - + Logger.Log("-----------------------------------------------", ConsoleColor.Green); Logger.Log("-----------------------------------------------", ConsoleColor.Green); Logger.Log($"Result renamed {changes} Types. Failed to rename {failures} Types", ConsoleColor.Green); - + if (!validate) { Logger.Log($"Assembly written to `{OutPath}`", ConsoleColor.Green); diff --git a/RecodeItLib/Utils/DataProvider.cs b/RecodeItLib/Utils/DataProvider.cs index a85dd72..46d3156 100644 --- a/RecodeItLib/Utils/DataProvider.cs +++ b/RecodeItLib/Utils/DataProvider.cs @@ -1,7 +1,6 @@ using dnlib.DotNet; using Newtonsoft.Json; using ReCodeIt.Models; -using ReCodeItLib.Utils; namespace ReCodeIt.Utils; @@ -30,12 +29,6 @@ public static class DataProvider public static void LoadAppSettings() { - if (IsCli) - { - Settings = CreateFakeSettings(); - return; - } - var settingsPath = Path.Combine(DataPath, "Settings.jsonc"); var jsonText = File.ReadAllText(settingsPath); @@ -46,14 +39,7 @@ public static class DataProvider }; Settings = JsonConvert.DeserializeObject(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}'"); } @@ -61,7 +47,7 @@ public static class DataProvider { if (IsCli) { return; } - var settingsPath = RegistryHelper.GetRegistryValue("SettingsPath"); + var settingsPath = Path.Combine(DataPath, "Settings.jsonc"); if (!File.Exists(settingsPath)) { @@ -150,91 +136,4 @@ public static class DataProvider 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; - } } \ No newline at end of file diff --git a/RecodeItLib/Utils/Logger.cs b/RecodeItLib/Utils/Logger.cs index aec4c04..e4ef50d 100644 --- a/RecodeItLib/Utils/Logger.cs +++ b/RecodeItLib/Utils/Logger.cs @@ -1,5 +1,4 @@ using System.Collections.Concurrent; -using ReCodeItLib.Utils; namespace ReCodeIt.Utils; @@ -85,8 +84,7 @@ public static class Logger } private const string _defaultFileName = "ReCodeIt.log"; - private static string _logPath => RegistryHelper.GetRegistryValue("LogPath") ?? $"{AppDomain.CurrentDomain.BaseDirectory}{_defaultFileName}"; - + private static string _logPath => Path.Combine(AppContext.BaseDirectory, "Data", "Settings.jsonc"); public static void ClearLog() { if (File.Exists(_logPath)) @@ -110,7 +108,7 @@ public static class Logger Console.ResetColor(); } - WriteToDisk(message.Message); + //WriteToDisk(message.Message); } private static void WriteToDisk(object message) diff --git a/RecodeItLib/Utils/RegistryHelper.cs b/RecodeItLib/Utils/RegistryHelper.cs deleted file mode 100644 index 112aefb..0000000 --- a/RecodeItLib/Utils/RegistryHelper.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.Win32; - -namespace ReCodeItLib.Utils; - -public static class RegistryHelper -{ - /// - /// Sets a key in the registry, given its key, value, and kind - /// - /// - /// - /// - public static void SetRegistryValue(string key, string value, RegistryValueKind kind) - { - var regKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\ReCodeIt"); - - regKey.SetValue(key, value, kind); - } - - /// - /// Gets a key from the registry, given its key and type - /// - /// - /// - /// - public static T? GetRegistryValue(string key) - { - var regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\ReCodeIt"); - return (T)regKey?.GetValue(key); - } -} \ No newline at end of file diff --git a/Templates/Settings.jsonc b/Templates/Settings.jsonc index 0926fd1..8cd0837 100644 --- a/Templates/Settings.jsonc +++ b/Templates/Settings.jsonc @@ -4,9 +4,9 @@ "SilentMode": true }, "Remapper": { - "AssemblyPath": "G:\\development\\ReCodeIt\\RecodeItGUI\\bin\\Debug\\net8.0-windows\\Data\\Managed\\Assembly-CSharp-cleaned.dll", - "OutputPath": "G:\\development\\ReCodeIt\\RecodeItGUI\\bin\\Debug\\net8.0-windows\\Data", - "MappingPath": "G:\\development\\ReCodeIt\\RecodeItGUI\\bin\\Debug\\net8.0-windows\\Data\\Mappings.jsonc", + "AssemblyPath": "", + "OutputPath": "", + "MappingPath": "", "UseProjectMappings": false, "MappingSettings": { "RenameFields": true,