private bool CreateProjectSolution() { using (var pr = new EditorProgress("create_csharp_solution", "Generating solution...".TTR(), 2)) { pr.Step("Generating C# project...".TTR()); string resourceDir = ProjectSettings.GlobalizePath("res://"); string path = resourceDir; string name = GodotSharpDirs.ProjectAssemblyName; string guid = CsProjOperations.GenerateGameProject(path, name); if (guid.Length > 0) { var solution = new DotNetSolution(name) { DirectoryPath = path }; var projectInfo = new DotNetSolution.ProjectInfo { Guid = guid, PathRelativeToSolution = name + ".csproj", Configs = new List <string> { "Debug", "ExportDebug", "ExportRelease" } }; solution.AddNewProject(name, projectInfo); try { solution.Save(); } catch (IOException e) { ShowErrorDialog("Failed to save solution. Exception message: ".TTR() + e.Message); return(false); } pr.Step("Done".TTR()); // Here, after all calls to progress_task_step CallDeferred(nameof(_RemoveCreateSlnMenuOption)); } else { ShowErrorDialog("Failed to create C# project.".TTR()); } return(true); } }
private bool CreateProjectSolution() { using (var pr = new EditorProgress("create_csharp_solution", "Generating solution...".TTR(), 3)) { pr.Step("Generating C# project...".TTR()); string resourceDir = ProjectSettings.GlobalizePath("res://"); string path = resourceDir; string name = (string)ProjectSettings.GetSetting("application/config/name"); if (name.Empty()) { name = "UnnamedProject"; } string guid = CsProjOperations.GenerateGameProject(path, name); if (guid.Length > 0) { var solution = new DotNetSolution(name) { DirectoryPath = path }; var projectInfo = new DotNetSolution.ProjectInfo { Guid = guid, PathRelativeToSolution = name + ".csproj", Configs = new List <string> { "Debug", "Release", "Tools" } }; solution.AddNewProject(name, projectInfo); try { solution.Save(); } catch (IOException e) { ShowErrorDialog("Failed to save solution. Exception message: ".TTR() + e.Message); return(false); } pr.Step("Updating Godot API assemblies...".TTR()); string debugApiAssembliesError = Internal.UpdateApiAssembliesFromPrebuilt("Debug"); if (!string.IsNullOrEmpty(debugApiAssembliesError)) { ShowErrorDialog("Failed to update the Godot API assemblies: " + debugApiAssembliesError); return(false); } string releaseApiAssembliesError = Internal.UpdateApiAssembliesFromPrebuilt("Release"); if (!string.IsNullOrEmpty(releaseApiAssembliesError)) { ShowErrorDialog("Failed to update the Godot API assemblies: " + releaseApiAssembliesError); return(false); } pr.Step("Done".TTR()); // Here, after all calls to progress_task_step CallDeferred(nameof(_RemoveCreateSlnMenuOption)); } else { ShowErrorDialog("Failed to create C# project.".TTR()); } return(true); } }
private bool CreateProjectSolution() { using (var pr = new EditorProgress("create_csharp_solution", "Generating solution...".TTR(), 2)) { pr.Step("Generating C# project...".TTR()); string resourceDir = ProjectSettings.GlobalizePath("res://"); string path = resourceDir; string name = (string)ProjectSettings.GetSetting("application/config/name"); if (name.Empty()) { name = "UnnamedProject"; } string guid = CSharpProject.GenerateGameProject(path, name); if (guid.Length > 0) { var solution = new DotNetSolution(name) { DirectoryPath = path }; var projectInfo = new DotNetSolution.ProjectInfo { Guid = guid, PathRelativeToSolution = name + ".csproj", Configs = new List <string> { "Debug", "Release", "Tools" } }; solution.AddNewProject(name, projectInfo); try { solution.Save(); } catch (IOException e) { ShowErrorDialog("Failed to save solution. Exception message: ".TTR() + e.Message); return(false); } // Make sure to update the API assemblies if they happen to be missing. Just in // case the user decided to delete them at some point after they were loaded. Internal.UpdateApiAssembliesFromPrebuilt(); pr.Step("Done".TTR()); // Here, after all calls to progress_task_step CallDeferred(nameof(_RemoveCreateSlnMenuOption)); } else { ShowErrorDialog("Failed to create C# project.".TTR()); } return(true); } }
private bool CreateProjectSolution() { using (var pr = new EditorProgress("create_csharp_solution", "Generating solution...", 2)) // TTR("Generating solution...") { pr.Step("Generating C# project..."); // TTR("Generating C# project...") string resourceDir = ProjectSettings.GlobalizePath("res://"); string path = resourceDir; string name = (string)ProjectSettings.GetSetting("application/config/name"); if (name.Empty()) { name = "UnnamedProject"; } string guid = CSharpProject.GenerateGameProject(path, name); if (guid.Length > 0) { var solution = new DotNetSolution(name) { DirectoryPath = path }; var projectInfo = new DotNetSolution.ProjectInfo { Guid = guid, PathRelativeToSolution = name + ".csproj", Configs = new List <string> { "Debug", "Release", "Tools" } }; solution.AddNewProject(name, projectInfo); try { solution.Save(); } catch (IOException e) { ShowErrorDialog($"Failed to save solution. Exception message: {e.Message}"); // TTR return(false); } string apiConfig = "Debug"; if (!GodotSharpBuilds.MakeApiAssembly(ApiAssemblyType.Core, apiConfig)) { return(false); } if (!GodotSharpBuilds.MakeApiAssembly(ApiAssemblyType.Editor, apiConfig)) { return(false); } pr.Step("Done"); // TTR("Done") // Here, after all calls to progress_task_step CallDeferred(nameof(_RemoveCreateSlnMenuOption)); } else { ShowErrorDialog("Failed to create C# project."); // TTR } return(true); } }