Some clean up

This commit is contained in:
Cj 2024-06-19 06:22:18 -04:00
parent 04ed493454
commit df568681f5
4 changed files with 27 additions and 27 deletions

View File

@ -1536,7 +1536,7 @@ partial class ReCodeItForm
// //
CCVisualStudioProjDirText.Location = new Point(6, 105); CCVisualStudioProjDirText.Location = new Point(6, 105);
CCVisualStudioProjDirText.Name = "CCVisualStudioProjDirText"; CCVisualStudioProjDirText.Name = "CCVisualStudioProjDirText";
CCVisualStudioProjDirText.PlaceholderText = "Visual studio solution directory"; CCVisualStudioProjDirText.PlaceholderText = "Visual studio solution";
CCVisualStudioProjDirText.ReadOnly = true; CCVisualStudioProjDirText.ReadOnly = true;
CCVisualStudioProjDirText.Size = new Size(501, 31); CCVisualStudioProjDirText.Size = new Size(501, 31);
CCVisualStudioProjDirText.TabIndex = 27; CCVisualStudioProjDirText.TabIndex = 27;

View File

@ -794,7 +794,8 @@ public partial class ReCodeItForm : Form
private void CCVisualStudioProjDirButton_Click(object sender, EventArgs e) private void CCVisualStudioProjDirButton_Click(object sender, EventArgs e)
{ {
var result = GUIHelpers.OpenFolderDialog("Select your visual studio project directory"); var result = GUIHelpers.OpenFileDialog("Select a Visual Studio solution file",
"Solution Files (*.sln)|*.sln|All Files (*.*)|*.*");
if (result != string.Empty) if (result != string.Empty)
{ {

View File

@ -103,38 +103,18 @@ public class ReCodeItCrossCompiler
/// </summary> /// </summary>
private void StartBuild() private void StartBuild()
{ {
var path = Path.Combine( var arguements = $"build {ActiveProject.VisualStudioClonedSolutionPath} " +
DataProvider.ReCodeItProjectsPath,
ActiveProject.SolutionName);
var csProjFile = Directory.GetFiles(path, "*.csproj", SearchOption.AllDirectories)
.ToList()
.FirstOrDefault();
if (csProjFile == null || csProjFile == string.Empty)
{
Logger.Log("No project files found in the solution directory or sub directories", ConsoleColor.Red);
return;
}
var dirName = Path.GetDirectoryName(csProjFile);
var solutionName = ActiveProject.SolutionName + ".sln";
var arguements = $"build {Path.Combine(path, solutionName)} " +
$"/p:Configuration=Debug " + $"/p:Configuration=Debug " +
$"/p:Platform=\"Any CPU\""; $"/p:Platform=\"Any CPU\"";
// clean the project first // clean the project first
ExecuteDotnetCommand("clean", path); ExecuteDotnetCommand("clean", ActiveProject.VisualStudioClonedSolutionDirectory);
// Restore packages // Restore packages
ExecuteDotnetCommand("restore", path); ExecuteDotnetCommand("restore", ActiveProject.VisualStudioClonedSolutionDirectory);
Logger.Log(path + ActiveProject.SolutionName + ".sln");
// Then build the project // Then build the project
ExecuteDotnetCommand(arguements, path); ExecuteDotnetCommand(arguements, ActiveProject.VisualStudioClonedSolutionDirectory);
} }
private static void ExecuteDotnetCommand(string arguments, string workingDirectory) private static void ExecuteDotnetCommand(string arguments, string workingDirectory)

View File

@ -1,4 +1,6 @@
namespace ReCodeIt.Models; using ReCodeIt.Utils;
namespace ReCodeIt.Models;
public class CrossCompilerProjectModel public class CrossCompilerProjectModel
{ {
@ -25,6 +27,23 @@ public class CrossCompilerProjectModel
/// </summary> /// </summary>
public string VisualStudioSolutionPath { get; set; } public string VisualStudioSolutionPath { get; set; }
/// <summary>
/// The path to the working directory vs project
/// </summary>
public string VisualStudioSolutionDirectoryPath => Path.GetDirectoryName(VisualStudioSolutionPath)!;
/// <summary>
/// The path the the cloned solution
/// </summary>
public string VisualStudioClonedSolutionPath => Path.Combine(
DataProvider.ReCodeItProjectsPath,
SolutionName,
SolutionName + ".sln");
public string VisualStudioClonedSolutionDirectory => Path.Combine(
DataProvider.ReCodeItProjectsPath,
SolutionName);
/// <summary> /// <summary>
/// This is where the final dll is built to /// This is where the final dll is built to
/// ///