Remove not needed components from lib/GUI

This commit is contained in:
Cj 2024-08-09 21:49:40 -04:00
parent e4aa655683
commit 46fc36169d
7 changed files with 1164 additions and 1962 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,4 @@
/// This entire file is fucked beyond belief, its just hacked together to make things work for now
using ReCodeIt.AutoMapper;
using ReCodeIt.CrossCompiler;
using ReCodeIt.Models;
using ReCodeIt.ReMapper;
using ReCodeIt.Utils;
@ -14,8 +11,6 @@ public partial class ReCodeItForm : Form
private static ReCodeItRemapper Remapper { get; set; } = new();
private static ReCodeItAutoMapper AutoMapper { get; set; } = new();
private static ReCodeItCrossCompiler CrossCompiler { get; set; }
private static Settings AppSettings => DataProvider.Settings;
private bool _isSearched = false;
@ -30,18 +25,14 @@ public partial class ReCodeItForm : Form
{
InitializeComponent();
CrossCompiler = new();
SubscribeToEvents();
PopulateDomainUpDowns();
RefreshSettingsPage();
RefreshAutoMapperPage();
RefreshCrossCompilerPage();
LoadMappingFile();
var remaps = AppSettings.Remapper.UseProjectMappings
? CrossCompiler.ActiveProject?.RemapModels
: DataProvider.Remaps;
var remaps = DataProvider.Remaps;
ReloadRemapTreeView(remaps);
}
@ -49,7 +40,6 @@ public partial class ReCodeItForm : Form
private void SubscribeToEvents()
{
RemapTreeView.NodeMouseDoubleClick += ManualEditSelectedRemap;
CCMappingTreeView.NodeMouseDoubleClick += CCEditSelectedRemap;
Remapper.OnComplete += ReloadTreeAfterMapping;
#region MANUAL_REMAPPER
@ -166,45 +156,15 @@ public partial class ReCodeItForm : Form
private void LoadMappingFile()
{
if (AppSettings.CrossCompiler.AutoLoadLastActiveProject
&& ActiveProjectMappingsCheckbox.Checked)
{
if (CrossCompiler.ActiveProject == null)
{
DataProvider.Remaps = DataProvider.LoadMappingFile(AppSettings.Remapper.MappingPath);
LoadedMappingFilePath.Text = AppSettings.Remapper.MappingPath;
return;
}
LoadedMappingFilePath.Text = $"Project Mode: ({CrossCompiler.ActiveProject.SolutionName})";
ReloadRemapTreeView(CrossCompiler.ActiveProject.RemapModels);
return;
}
DataProvider.Remaps = DataProvider.LoadMappingFile(AppSettings.Remapper.MappingPath);
LoadedMappingFilePath.Text = AppSettings.Remapper.MappingPath;
}
private void UseProjectAutoMapping_Clicked(object sender, EventArgs e)
{
bool enabled = ActiveProjectMappingsCheckbox.Checked;
var remaps = DataProvider.Remaps;
AppSettings.Remapper.UseProjectMappings = enabled;
var remaps = enabled && CrossCompiler?.ActiveProject?.RemapModels != null
? CrossCompiler?.ActiveProject?.RemapModels
: DataProvider.Remaps;
if (enabled && CrossCompiler?.ActiveProject != null)
{
LoadedMappingFilePath.Text = $"Project Mode: ({CrossCompiler.ActiveProject.SolutionName})";
}
else
{
LoadedMappingFilePath.Text = AppSettings.Remapper?.MappingPath;
}
LoadedMappingFilePath.Text = AppSettings.Remapper?.MappingPath;
ReloadRemapTreeView(remaps!);
}
@ -220,9 +180,7 @@ public partial class ReCodeItForm : Form
bool projectMode = AppSettings.Remapper.UseProjectMappings;
var remaps = projectMode
? CrossCompiler.ActiveProject.RemapModels
: DataProvider.Remaps;
var remaps = DataProvider.Remaps;
var matches = remaps
.Where(x => x.NewTypeName == RMSearchBox.Text
@ -244,9 +202,7 @@ public partial class ReCodeItForm : Form
{
bool projectMode = AppSettings.Remapper.UseProjectMappings;
var remaps = projectMode
? CrossCompiler.ActiveProject.RemapModels
: DataProvider.Remaps;
var remaps = DataProvider.Remaps;
RemapTreeView.Nodes.Clear();
ReloadRemapTreeView(remaps);
@ -354,9 +310,7 @@ public partial class ReCodeItForm : Form
Logger.Log(projectMode);
var remaps = projectMode
? CrossCompiler.ActiveProject.RemapModels
: DataProvider.Remaps;
var remaps = DataProvider.Remaps;
var existingRemap = remaps
.FirstOrDefault(remap => remap.NewTypeName == newRemap.NewTypeName);
@ -378,14 +332,7 @@ public partial class ReCodeItForm : Form
remaps.Insert(index, newRemap);
RemapTreeView.Nodes.Insert(index, GUIHelpers.GenerateTreeNode(newRemap, this));
if (projectMode)
{
ProjectManager.SaveCrossCompilerProjectModel(CrossCompiler.ActiveProject);
}
else
{
DataProvider.SaveMapping();
}
DataProvider.SaveMapping();
ReloadRemapTreeView(remaps);
@ -393,16 +340,8 @@ public partial class ReCodeItForm : Form
return;
}
if (projectMode)
{
CrossCompiler.ActiveProject.RemapModels.Add(newRemap);
ProjectManager.SaveCrossCompilerProjectModel(CrossCompiler.ActiveProject);
}
else
{
DataProvider.Remaps.Add(newRemap);
DataProvider.SaveMapping();
}
DataProvider.Remaps.Add(newRemap);
DataProvider.SaveMapping();
var node = GUIHelpers.GenerateTreeNode(newRemap, this);
@ -426,9 +365,7 @@ public partial class ReCodeItForm : Form
{
bool projectMode = AppSettings.Remapper.UseProjectMappings;
var remaps = projectMode
? CrossCompiler.ActiveProject.RemapModels
: DataProvider.Remaps;
var remaps = DataProvider.Remaps;
remaps.Remove(node.Value);
RemapNodes.Remove(node.Key);
@ -438,12 +375,6 @@ public partial class ReCodeItForm : Form
ResetAllRemapFields();
if (AppSettings.Remapper.UseProjectMappings)
{
ProjectManager.SaveCrossCompilerProjectModel(CrossCompiler.ActiveProject);
return;
}
DataProvider.SaveMapping();
}
@ -451,17 +382,6 @@ public partial class ReCodeItForm : Form
{
if (ReCodeItRemapper.IsRunning) { return; }
if (AppSettings.Remapper.UseProjectMappings)
{
Remapper.InitializeRemap(
CrossCompiler.ActiveProject.RemapModels,
CrossCompiler.ActiveProject.OriginalAssemblyPath,
CrossCompiler.ActiveProject.VisualStudioDependencyPath);
ReloadRemapTreeView(CrossCompiler.ActiveProject.RemapModels);
return;
}
if (string.IsNullOrEmpty(AppSettings.Remapper.AssemblyPath))
{
MessageBox.Show("Please select an assembly path", "Assembly not loaded");
@ -516,7 +436,6 @@ public partial class ReCodeItForm : Form
DataProvider.Remaps = DataProvider.LoadMappingFile(result);
AppSettings.Remapper.MappingPath = result;
AppSettings.Remapper.UseProjectMappings = false;
ActiveProjectMappingsCheckbox.Checked = false;
LoadedMappingFilePath.Text = result;
@ -793,7 +712,6 @@ public partial class ReCodeItForm : Form
RenamePropertiesCheckbox.Checked = AppSettings.Remapper.MappingSettings.RenameProperties;
RemapperPublicicize.Checked = AppSettings.Remapper.MappingSettings.Publicize;
RemapperUnseal.Checked = AppSettings.Remapper.MappingSettings.Unseal;
ActiveProjectMappingsCheckbox.Checked = AppSettings.Remapper.UseProjectMappings;
}
#region CHECKBOXES
@ -992,200 +910,6 @@ public partial class ReCodeItForm : Form
#endregion AUTOMAPPER
#region CROSS_COMPILER
private void OnCCTabPageValidate(object sender, EventArgs e)
{
RefreshCrossCompilerPage();
}
private void RefreshCrossCompilerPage()
{
var ccSettings = AppSettings.CrossCompiler;
CCAutoLoadLastProj.Checked = ccSettings.AutoLoadLastActiveProject;
if (ccSettings.AutoLoadLastActiveProject)
{
// Dont continue if its an empty string, it hasnt been set yet
if (ccSettings.LastLoadedProject == string.Empty)
{
return;
}
if (!File.Exists(ccSettings.LastLoadedProject))
{
ccSettings.LastLoadedProject = string.Empty;
MessageBox.Show("Couldnt find last loaded project");
return;
}
ProjectManager.LoadProject(ccSettings.LastLoadedProject);
}
if (CrossCompiler.ActiveProject == null)
{
return;
}
var activeProj = CrossCompiler.ActiveProject;
CCOriginalAssemblyText.Text = activeProj.OriginalAssemblyPath;
CCProjectDepdendencyText.Text = activeProj.VisualStudioDependencyPath;
CCVisualStudioProjDirText.Text = activeProj.VisualStudioSolutionPath;
CCBuildDirText.Text = activeProj.BuildDirectory;
ReloadCCRemapTreeView(activeProj.RemapModels);
}
private void CCOriginalAssemblyButton_Click(object sender, EventArgs e)
{
var result = GUIHelpers.OpenFileDialog("Select a DLL file",
"DLL Files (*.dll)|*.dll|All Files (*.*)|*.*");
if (result != string.Empty)
{
CCOriginalAssemblyText.Text = result;
}
}
private void CCProjectDependencyButton_Click(object sender, EventArgs e)
{
var result = GUIHelpers.OpenFolderDialog("Select your projects reference folder, this is where the Re-Mapped output will be placed as well.");
if (result != string.Empty)
{
CCProjectDepdendencyText.Text = result;
}
}
private void CCVisualStudioProjDirButton_Click(object sender, EventArgs e)
{
var result = GUIHelpers.OpenFileDialog("Select a Visual Studio solution file",
"Solution Files (*.sln)|*.sln|All Files (*.*)|*.*");
if (result != string.Empty)
{
CCVisualStudioProjDirText.Text = result;
}
}
private void CCBuildDirButton_Click(object sender, EventArgs e)
{
var result = GUIHelpers.OpenFolderDialog("Select where you want to final dll built at");
if (result != string.Empty)
{
CCBuildDirText.Text = result;
}
}
private void CrossPatchRemapButton_Click(object sender, EventArgs e)
{
if (CrossCompiler.ActiveProject.RemapModels.Count == 0)
{
MessageBox.Show("You cannot generate a remapped dll without creating remaps first");
return;
}
CrossCompiler.StartRemap();
}
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");
return;
}
CrossCompiler.StartCrossCompile();
}
private void CrossCompilerNewProjectButton_Click(object sender, EventArgs e)
{
if (CCOriginalAssemblyText.Text == string.Empty
|| CCProjectDepdendencyText.Text == string.Empty
|| CCVisualStudioProjDirText.Text == string.Empty
|| CCBuildDirText.Text == string.Empty)
{
// Dont create a project if any required fields are empty
MessageBox.Show("Cannot create a project without setting all paths in the project settings");
return;
}
ProjectManager.CreateProject(
CCOriginalAssemblyText.Text,
CCVisualStudioProjDirText.Text,
CCProjectDepdendencyText.Text,
CCBuildDirText.Text);
}
private void CCLoadProjButton_Click(object sender, EventArgs e)
{
var result = GUIHelpers.OpenFileDialog("select a ReCodeItProj.json File",
"JSON Files (*.json)|*.json|JSONC Files (*.jsonc)|*.jsonc|All Files (*.*)|*.*");
if (result != string.Empty)
{
ProjectManager.LoadProject(result);
ReloadCCRemapTreeView(ProjectManager.ActiveProject.RemapModels);
}
}
private void CCAutoLoadLastProj_CheckedChanged_1(object sender, EventArgs e)
{
AppSettings.CrossCompiler.AutoLoadLastActiveProject = CCAutoLoadLastProj.Checked;
}
private void CCImportMappings_Click(object sender, EventArgs e)
{
if (CrossCompiler.ActiveProject == null)
{
MessageBox.Show("No project is loaded to add mappings too.");
return;
}
var answer = MessageBox.Show(
"'Yes' to Add the items to the existing list, or 'No' to clear the list before adding these.",
"Add Items to existing list?",
MessageBoxButtons.YesNoCancel);
switch (answer)
{
case DialogResult.Yes:
break;
case DialogResult.No:
CrossCompiler.ActiveProject.RemapModels.Clear();
break;
case DialogResult.Cancel:
return;
default:
break;
}
var result = GUIHelpers.OpenFileDialog("Select a mapping file",
"JSON Files (*.json)|*.json|JSONC Files (*.jsonc)|*.jsonc|All Files (*.*)|*.*");
if (result == string.Empty) { return; }
var remaps = DataProvider.LoadMappingFile(result);
CrossCompiler.ActiveProject.RemapModels.AddRange(remaps);
ReloadCCRemapTreeView(CrossCompiler.ActiveProject.RemapModels);
}
#endregion CROSS_COMPILER
// Reset All UI elements to default
private void ResetAllRemapFields()
@ -1238,24 +962,6 @@ public partial class ReCodeItForm : Form
NestedTypesExcludeBox.Items.Clear();
}
private void CCEditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e)
{
if (e?.Node.Level != 0 || CCMappingTreeView?.SelectedNode?.Index < 0 || CCMappingTreeView?.SelectedNode?.Index == null)
{
return;
}
_selectedCCRemapTreeIndex = CCMappingTreeView.SelectedNode.Index;
// Go to remapper page
TabControlMain.SelectedIndex = 0;
DataProvider.Settings.Remapper.UseProjectMappings = true;
ActiveProjectMappingsCheckbox.Checked = true;
EditSelectedRemap(this, e, true);
}
private void ManualEditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e)
{
EditSelectedRemap(this, e);
@ -1279,9 +985,7 @@ public partial class ReCodeItForm : Form
{
bool projectMode = AppSettings.Remapper.UseProjectMappings;
var remaps = projectMode
? CrossCompiler.ActiveProject.RemapModels
: DataProvider.Remaps;
var remaps = DataProvider.Remaps;
remap = remaps.FirstOrDefault(x => x.NewTypeName == node.Value.NewTypeName);
@ -1471,17 +1175,6 @@ public partial class ReCodeItForm : Form
}
}
private void ReloadCCRemapTreeView(List<RemapModel> remaps)
{
CCMappingTreeView.Nodes.Clear();
RemapNodes.Clear();
foreach (var remap in remaps)
{
CCMappingTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this));
}
}
private void GithubLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(new ProcessStartInfo

View File

@ -1,131 +0,0 @@
using Microsoft.CodeAnalysis;
using Microsoft.Win32;
using Newtonsoft.Json;
using ReCodeIt.Models;
using ReCodeIt.Utils;
namespace ReCodeIt.CrossCompiler;
public static class ProjectManager
{
public static CrossCompilerProjectModel ActiveProject { get; private set; }
private static CrossCompilerSettings Settings => DataProvider.Settings.CrossCompiler;
public static List<string> AllProjectSourceFiles { get; private set; } = [];
public static void CreateProject(
string OrigAssemblyPath,
string VSSolutionDirPath,
string DependencyPath,
string BuildPath)
{
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
Logger.Log($"Generating Cross Compiler project", ConsoleColor.Yellow);
Logger.Log($"Original Assembly Path {OrigAssemblyPath}", ConsoleColor.Yellow);
Logger.Log($"Remapped Assembly Path: {DependencyPath}", ConsoleColor.Yellow);
Logger.Log($"Visual Studio Solution Directory: {VSSolutionDirPath}", ConsoleColor.Yellow);
Logger.Log($"Build Path: {BuildPath}", ConsoleColor.Yellow);
// Build the project model
ActiveProject = new CrossCompilerProjectModel
{
OriginalAssemblyPath = OrigAssemblyPath,
VisualStudioSolutionPath = VSSolutionDirPath,
VisualStudioDependencyPath = DependencyPath,
BuildDirectory = BuildPath,
OriginalAssemblyHash = HashUtil.GetFileHash(OrigAssemblyPath),
RemappedAssemblyHash = "",
ChangedTypes = [],
RemapModels = []
};
// Now save the project json inside the original solution directory
SaveCrossCompilerProjectModel(ActiveProject);
Logger.Log($"Found Solution: {ActiveProject.SolutionName}", ConsoleColor.Yellow);
Logger.Log($"Original Assembly Checksum: {ActiveProject.OriginalAssemblyHash}", ConsoleColor.Yellow);
Logger.Log($"Project Generated to: {DataProvider.Settings.CrossCompiler.LastLoadedProject}", ConsoleColor.Green);
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
}
/// <summary>
/// Saves the provided project model to disk, used from the GUI
/// </summary>
/// <param name="model"></param>
public static void SaveCrossCompilerProjectModel(CrossCompilerProjectModel model)
{
var path = Path.Combine(model.VisualStudioSolutionDirectoryPath, "ReCodeItProj.json");
JsonSerializerSettings settings = new()
{
Formatting = Formatting.Indented
};
var jsonText = JsonConvert.SerializeObject(model, settings);
File.WriteAllText(path, jsonText);
DataProvider.Settings.CrossCompiler.LastLoadedProject = path;
DataProvider.SaveAppSettings();
Logger.Log($"Cross Compiler project json saved to {path}", ConsoleColor.Green);
}
/// <summary>
/// The "LoadProject" method only loads the project file from disk, used for initiating the GUI
/// </summary>
/// <param name="path"></param>
/// <param name="cli"></param>
public static void LoadProject(string path, bool cli = false)
{
ActiveProject = LoadCrossCompilerProjModel(path, cli);
Logger.Log($"Found and Loaded ReCodeIt Project at {path}");
}
/// <summary>
/// Loads the project model from disk
/// </summary>
/// <param name="path"></param>
/// <param name="cli"></param>
/// <returns></returns>
private static CrossCompilerProjectModel LoadCrossCompilerProjModel(string path, bool cli = false)
{
if (!File.Exists(path))
{
Logger.Log($"Error loading cache model from `{path}`", ConsoleColor.Red);
}
var jsonText = File.ReadAllText(path);
var model = JsonConvert.DeserializeObject<CrossCompilerProjectModel>(jsonText);
if (!cli)
{
DataProvider.Settings.CrossCompiler.LastLoadedProject = path;
}
DataProvider.SaveAppSettings();
Logger.Log($"Loaded Cross Compiler Project: {model?.VisualStudioSolutionDirectoryPath}");
return model!;
}
/// <summary>
/// Gathers all the projects source files
/// </summary>
private static void LoadProjectSourceFiles()
{
var path = Path.Combine(
DataProvider.ReCodeItProjectsPath,
ActiveProject.SolutionName);
// Find all the source files in the project, we dont want anything from the obj folder.
AllProjectSourceFiles = Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories)
.Where(file => !file.Contains(Path.DirectorySeparatorChar + "obj" + Path.DirectorySeparatorChar))
.ToList();
Logger.Log($"Found {AllProjectSourceFiles.Count} source files in the project", ConsoleColor.Yellow);
}
}

View File

@ -1,193 +0,0 @@
using Microsoft.Build.Locator;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.MSBuild;
using ReCodeIt.Models;
using ReCodeIt.ReMapper;
using ReCodeIt.Utils;
using System.Diagnostics;
namespace ReCodeIt.CrossCompiler;
public class ReCodeItCrossCompiler
{
public ReCodeItCrossCompiler()
{
Remapper = new(this);
}
public CrossCompilerProjectModel ActiveProject => ProjectManager.ActiveProject;
private CrossCompilerSettings Settings => DataProvider.Settings.CrossCompiler;
private ReCodeItRemapper Remapper { get; }
private Stopwatch SW { get; } = new();
public void StartRemap()
{
ActiveProject.ChangedTypes.Clear();
if (ActiveProject == null)
{
Logger.Log("ERROR: No Cross Compiler Project is loaded, create or load one first.", ConsoleColor.Red);
return;
}
Remapper.InitializeRemap(
ActiveProject.RemapModels,
ActiveProject.OriginalAssemblyPath,
ActiveProject.VisualStudioDependencyPath,
true);
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
Logger.Log($"Generated Cross Mapped DLL for project {ActiveProject.SolutionName}", ConsoleColor.Green);
Logger.Log($"Built to: {Path.Combine(ActiveProject.VisualStudioDependencyPath, ActiveProject.OriginalAssemblyDllName)}", ConsoleColor.Green);
Logger.Log($"Changed {ActiveProject.ChangedTypes.Count} types", ConsoleColor.Green);
Logger.Log($"Original assembly path: {ActiveProject.OriginalAssemblyPath}", ConsoleColor.Green);
Logger.Log($"Original assembly hash: {ActiveProject.OriginalAssemblyHash}", ConsoleColor.Green);
Logger.Log($"Original patched assembly path: {ActiveProject.VisualStudioDependencyPath}", ConsoleColor.Green);
//Logger.Log($"Original patched assembly hash: {ActiveProject.RemappedAssemblyHash}", ConsoleColor.Green);
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
}
public async Task StartCrossCompile()
{
SW.Reset();
SW.Start();
var workspace = MSBuildWorkspace.Create();
Logger.Log("Loading Solution...", ConsoleColor.Yellow);
var solution = await Task.Run(() => LoadSolutionAsync(workspace, ActiveProject.VisualStudioSolutionPath));
Project newProject;
// Make sure we loop over the Id's instead of projects, because they are immutable
foreach (var projId in solution.ProjectIds)
{
newProject = solution.GetProject(projId);
Logger.Log("Reversing Identifier Changes...", ConsoleColor.Yellow);
foreach (var docId in newProject.DocumentIds)
{
var doc = newProject.GetDocument(docId);
// Remove the document from the project
newProject = newProject.RemoveDocument(docId);
// We only want C# source code
if (doc.SourceCodeKind != SourceCodeKind.Regular) { continue; }
var syntaxTree = await doc.GetSyntaxTreeAsync();
var syntaxRoot = syntaxTree!.GetCompilationUnitRoot();
syntaxRoot = FindAndChangeIdentifiers(syntaxRoot);
var newDoc = newProject.AddDocument(doc.Name, syntaxRoot.GetText());
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);
var comp = await project.GetCompilationAsync();
foreach (var diag in comp.GetDiagnostics())
{
Logger.Log(diag.ToString());
}
WriteAssembly(comp);
}
private void WriteAssembly(Compilation comp)
{
using (var ms = new MemoryStream())
{
EmitResult emitResult = comp.Emit(ms);
// Check if the compilation was successful
if (emitResult.Success)
{
var assemblyPath = $"{ActiveProject.BuildDirectory}\\{ActiveProject.ProjectDllName}";
using (var fs = new FileStream(assemblyPath, FileMode.Create, FileAccess.Write))
{
ms.Seek(0, SeekOrigin.Begin);
ms.CopyTo(fs);
}
Logger.Log($"Compilation succeeded. Time ({SW.Elapsed.TotalSeconds:F1}) seconds, Assembly written to: {assemblyPath}", ConsoleColor.Green);
SW.Stop();
}
else
{
Logger.Log("Compilation failed.");
foreach (var diagnostic in emitResult.Diagnostics)
{
Logger.Log(diagnostic.ToString());
}
SW.Stop();
}
}
}
private async Task<Solution> LoadSolutionAsync(MSBuildWorkspace workspace, string solutionPath)
{
if (!MSBuildLocator.IsRegistered) MSBuildLocator.RegisterDefaults();
using (var w = MSBuildWorkspace.Create())
{
return await w.OpenSolutionAsync(solutionPath);
}
}
private CompilationUnitSyntax FindAndChangeIdentifiers(CompilationUnitSyntax syntax)
{
// Get the things we want to change
var identifiers = syntax.DescendantNodes()
.OfType<IdentifierNameSyntax>()
.Where(id => ActiveProject.ChangedTypes.ContainsKey(id.Identifier.Text));
// Do Black Voodoo Magic
var newSyntax = syntax.ReplaceNodes(identifiers, (oldNode, newNode) =>
SyntaxFactory.IdentifierName(ActiveProject.ChangedTypes[oldNode.Identifier.Text])
.WithLeadingTrivia(oldNode.GetLeadingTrivia())
.WithTrailingTrivia(oldNode.GetTrailingTrivia()));
return newSyntax;
}
}

View File

@ -8,14 +8,170 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\cs\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\cs\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\cs\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\de\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\de\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\de\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\es\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\es\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\es\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\fr\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\fr\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\fr\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Humanizer.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\it\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\it\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\it\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ja\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ja\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ja\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ko\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ko\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ko\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Bcl.AsyncInterfaces.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Build.Locator.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.CodeAnalysis.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.CodeAnalysis.pdb" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe.config" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.pdb" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Configuration.Abstractions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Configuration.Binder.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Configuration.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.DependencyInjection.Abstractions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.DependencyInjection.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Logging.Abstractions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Logging.Configuration.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Logging.Console.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Logging.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Options.ConfigurationExtensions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Options.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Microsoft.Extensions.Primitives.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\Newtonsoft.Json.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\pl\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\pl\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\pl\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\pt-BR\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\pt-BR\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\pt-BR\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ru\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ru\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\ru\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Buffers.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Collections.Immutable.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.CommandLine.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Composition.AttributedModel.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Composition.Convention.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Composition.Hosting.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Composition.Runtime.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Composition.TypedParts.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Diagnostics.DiagnosticSource.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.IO.Pipelines.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Memory.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Numerics.Vectors.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Reflection.Metadata.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Runtime.CompilerServices.Unsafe.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Text.Encoding.CodePages.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Text.Encodings.Web.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Text.Json.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Threading.Channels.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.Threading.Tasks.Extensions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\System.ValueTuple.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\tr\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\tr\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\tr\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\zh-Hans\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\zh-Hans\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\zh-Hans\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\zh-Hant\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\zh-Hant\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-net472\zh-Hant\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\cs\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\cs\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\cs\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\de\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\de\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\de\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\es\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\es\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\es\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\fr\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\fr\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\fr\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Humanizer.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\it\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\it\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\it\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ja\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ja\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ja\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ko\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ko\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ko\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Bcl.AsyncInterfaces.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Build.Locator.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.pdb" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.deps.json" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.dll.config" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.runtimeconfig.json" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.pdb" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Configuration.Abstractions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Configuration.Binder.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Configuration.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.DependencyInjection.Abstractions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.DependencyInjection.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Logging.Abstractions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Logging.Configuration.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Logging.Console.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Logging.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Options.ConfigurationExtensions.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Options.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Extensions.Primitives.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\Newtonsoft.Json.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\pl\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\pl\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\pl\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\pt-BR\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\pt-BR\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\pt-BR\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\runtimes\browser\lib\net6.0\System.Text.Encodings.Web.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\runtimes\win\lib\net6.0\System.Text.Encoding.CodePages.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ru\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ru\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\ru\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Collections.Immutable.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.CommandLine.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Composition.AttributedModel.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Composition.Convention.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Composition.Hosting.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Composition.Runtime.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Composition.TypedParts.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.IO.Pipelines.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Reflection.Metadata.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Text.Encoding.CodePages.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Text.Encodings.Web.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Text.Json.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\System.Threading.Channels.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\tr\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\tr\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\tr\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\zh-Hans\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\zh-Hans\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\zh-Hans\System.CommandLine.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\zh-Hant\Microsoft.CodeAnalysis.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\zh-Hant\Microsoft.CodeAnalysis.Workspaces.resources.dll" />
<Content Remove="C:\Users\dirtb\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.10.0\contentFiles\any\any\BuildHost-netcore\zh-Hant\System.CommandLine.resources.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="dnlib" Version="4.4.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.7.8" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.10.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@ -1,6 +1,5 @@
using dnlib.DotNet;
using dnlib.DotNet.Emit;
using ReCodeIt.CrossCompiler;
using ReCodeIt.Enums;
using ReCodeIt.Models;
using ReCodeIt.ReMapper.Search;
@ -12,18 +11,11 @@ namespace ReCodeIt.ReMapper;
public class ReCodeItRemapper
{
public ReCodeItRemapper(ReCodeItCrossCompiler compiler)
{
_compiler = compiler;
}
public ReCodeItRemapper()
{ }
private ModuleDefMD? Module { get; set; }
private readonly ReCodeItCrossCompiler _compiler;
public static bool IsRunning { get; private set; } = false;
public delegate void OnCompleteHandler();
@ -120,11 +112,6 @@ public class ReCodeItRemapper
// We are done, write the assembly
WriteAssembly();
if (CrossMapMode)
{
ProjectManager.SaveCrossCompilerProjectModel(_compiler.ActiveProject);
}
}
private bool Validate(List<RemapModel> remaps)
@ -219,11 +206,6 @@ public class ReCodeItRemapper
_alreadyGivenNames.Add(mapping.OriginalTypeName);
if (CrossMapMode)
{// Store the original types for caching
_compiler.ActiveProject.ChangedTypes.Add(mapping.NewTypeName, mapping.OriginalTypeName);
}
return;
}
}
@ -268,11 +250,6 @@ public class ReCodeItRemapper
remap.Succeeded = true;
remap.OriginalTypeName = winner.Name.String;
if (CrossMapMode)
{// Store the original types for caching
_compiler.ActiveProject.ChangedTypes.Add(winner.Name.String, remap.OriginalTypeName);
}
}
/// <summary>

View File

@ -6,14 +6,6 @@ namespace ReCodeIt.Utils;
public static class DataProvider
{
static DataProvider()
{
if (!Directory.Exists(ReCodeItProjectsPath))
{
Directory.CreateDirectory(ReCodeItProjectsPath);
}
}
/// <summary>
/// Is this running in the CLI?
/// </summary>
@ -21,8 +13,6 @@ public static class DataProvider
public static string DataPath => Path.Combine(AppContext.BaseDirectory, "Data");
public static readonly string ReCodeItProjectsPath = Path.Combine(AppContext.BaseDirectory, "Projects");
public static List<RemapModel> Remaps { get; set; } = [];
public static Settings Settings { get; private set; }