Merge pull request #34277 from aaronfranke/mono-format
Code formatting for the Mono module
This commit is contained in:
commit
234fab949a
31 changed files with 571 additions and 577 deletions
|
@ -18,7 +18,7 @@ namespace GodotTools.BuildLogger
|
|||
if (null == Parameters)
|
||||
throw new LoggerException("Log directory was not set.");
|
||||
|
||||
var parameters = Parameters.Split(new[] {';'});
|
||||
var parameters = Parameters.Split(new[] { ';' });
|
||||
|
||||
string logDir = parameters[0];
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace GodotTools.Core
|
|||
|
||||
path = path.Replace('\\', '/');
|
||||
|
||||
string[] parts = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] parts = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
path = string.Join(Path.DirectorySeparatorChar.ToString(), parts).Trim();
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace GodotTools.Core
|
|||
|
||||
public static string CsvEscape(this string value, char delimiter = ',')
|
||||
{
|
||||
bool hasSpecialChar = value.IndexOfAny(new char[] {'\"', '\n', '\r', delimiter}) != -1;
|
||||
bool hasSpecialChar = value.IndexOfAny(new char[] { '\"', '\n', '\r', delimiter }) != -1;
|
||||
|
||||
if (hasSpecialChar)
|
||||
return "\"" + value.Replace("\"", "\"\"") + "\"";
|
||||
|
@ -54,7 +54,7 @@ namespace GodotTools.Core
|
|||
|
||||
public static string ToSafeDirName(this string dirName, bool allowDirSeparator)
|
||||
{
|
||||
var invalidChars = new List<string> {":", "*", "?", "\"", "<", ">", "|"};
|
||||
var invalidChars = new List<string> { ":", "*", "?", "\"", "<", ">", "|" };
|
||||
|
||||
if (allowDirSeparator)
|
||||
{
|
||||
|
|
|
@ -201,7 +201,7 @@ namespace GodotTools.IdeConnection
|
|||
|
||||
clientReader?.Dispose();
|
||||
clientWriter?.Dispose();
|
||||
((IDisposable) tcpClient)?.Dispose();
|
||||
((IDisposable)tcpClient)?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace GodotTools.ProjectEditor
|
|||
mainGroup.SetProperty("BaseIntermediateOutputPath", "obj");
|
||||
|
||||
GenAssemblyInfoFile(root, dir, CoreApiProjectName,
|
||||
new[] {"[assembly: InternalsVisibleTo(\"" + EditorApiProjectName + "\")]"},
|
||||
new[] {"System.Runtime.CompilerServices"});
|
||||
new[] { "[assembly: InternalsVisibleTo(\"" + EditorApiProjectName + "\")]" },
|
||||
new[] { "System.Runtime.CompilerServices" });
|
||||
|
||||
foreach (var item in compileItems)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DotNet.Glob" version="2.1.1" targetFramework="net45" />
|
||||
</packages>
|
|
@ -34,7 +34,7 @@ namespace GodotTools
|
|||
|
||||
for (int i = 0; i < buildTabs.GetChildCount(); i++)
|
||||
{
|
||||
var tab = (BuildTab) buildTabs.GetChild(i);
|
||||
var tab = (BuildTab)buildTabs.GetChild(i);
|
||||
|
||||
if (tab == null)
|
||||
continue;
|
||||
|
@ -120,7 +120,7 @@ namespace GodotTools
|
|||
if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
|
||||
throw new InvalidOperationException("No tab selected");
|
||||
|
||||
var buildTab = (BuildTab) buildTabs.GetChild(currentTab);
|
||||
var buildTab = (BuildTab)buildTabs.GetChild(currentTab);
|
||||
buildTab.WarningsVisible = pressed;
|
||||
buildTab.UpdateIssuesList();
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ namespace GodotTools
|
|||
if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
|
||||
throw new InvalidOperationException("No tab selected");
|
||||
|
||||
var buildTab = (BuildTab) buildTabs.GetChild(currentTab);
|
||||
var buildTab = (BuildTab)buildTabs.GetChild(currentTab);
|
||||
buildTab.ErrorsVisible = pressed;
|
||||
buildTab.UpdateIssuesList();
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ namespace GodotTools
|
|||
|
||||
int selectedItem = selectedItems[0];
|
||||
|
||||
var buildTab = (BuildTab) buildTabs.GetTabControl(selectedItem);
|
||||
var buildTab = (BuildTab)buildTabs.GetTabControl(selectedItem);
|
||||
|
||||
OS.ShellOpen(Path.Combine(buildTab.BuildInfo.LogsDirPath, BuildManager.MsBuildLogFileName));
|
||||
}
|
||||
|
@ -249,14 +249,14 @@ namespace GodotTools
|
|||
|
||||
var editorBaseControl = editorInterface.GetBaseControl();
|
||||
|
||||
SizeFlagsVertical = (int) SizeFlags.ExpandFill;
|
||||
SizeFlagsVertical = (int)SizeFlags.ExpandFill;
|
||||
SetAnchorsAndMarginsPreset(LayoutPreset.Wide);
|
||||
|
||||
panelTabs = new TabContainer
|
||||
{
|
||||
TabAlign = TabContainer.TabAlignEnum.Left,
|
||||
RectMinSize = new Vector2(0, 228) * EditorScale,
|
||||
SizeFlagsVertical = (int) SizeFlags.ExpandFill
|
||||
SizeFlagsVertical = (int)SizeFlags.ExpandFill
|
||||
};
|
||||
panelTabs.AddStyleboxOverride("panel", editorBaseControl.GetStylebox("DebuggerPanel", "EditorStyles"));
|
||||
panelTabs.AddStyleboxOverride("tab_fg", editorBaseControl.GetStylebox("DebuggerTabFG", "EditorStyles"));
|
||||
|
@ -268,11 +268,11 @@ namespace GodotTools
|
|||
panelBuildsTab = new VBoxContainer
|
||||
{
|
||||
Name = "Builds".TTR(),
|
||||
SizeFlagsHorizontal = (int) SizeFlags.ExpandFill
|
||||
SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
|
||||
};
|
||||
panelTabs.AddChild(panelBuildsTab);
|
||||
|
||||
var toolBarHBox = new HBoxContainer {SizeFlagsHorizontal = (int) SizeFlags.ExpandFill};
|
||||
var toolBarHBox = new HBoxContainer { SizeFlagsHorizontal = (int)SizeFlags.ExpandFill };
|
||||
panelBuildsTab.AddChild(toolBarHBox);
|
||||
|
||||
var buildProjectBtn = new Button
|
||||
|
@ -320,12 +320,12 @@ namespace GodotTools
|
|||
|
||||
var hsc = new HSplitContainer
|
||||
{
|
||||
SizeFlagsHorizontal = (int) SizeFlags.ExpandFill,
|
||||
SizeFlagsVertical = (int) SizeFlags.ExpandFill
|
||||
SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
|
||||
SizeFlagsVertical = (int)SizeFlags.ExpandFill
|
||||
};
|
||||
panelBuildsTab.AddChild(hsc);
|
||||
|
||||
buildTabsList = new ItemList {SizeFlagsHorizontal = (int) SizeFlags.ExpandFill};
|
||||
buildTabsList = new ItemList { SizeFlagsHorizontal = (int)SizeFlags.ExpandFill };
|
||||
buildTabsList.Connect("item_selected", this, nameof(_BuildTabsItemSelected));
|
||||
buildTabsList.Connect("nothing_selected", this, nameof(_BuildTabsNothingSelected));
|
||||
hsc.AddChild(buildTabsList);
|
||||
|
@ -333,7 +333,7 @@ namespace GodotTools
|
|||
buildTabs = new TabContainer
|
||||
{
|
||||
TabAlign = TabContainer.TabAlignEnum.Left,
|
||||
SizeFlagsHorizontal = (int) SizeFlags.ExpandFill,
|
||||
SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
|
||||
TabsVisible = false
|
||||
};
|
||||
hsc.AddChild(buildTabs);
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace GodotTools.Build
|
|||
{
|
||||
if (OS.IsWindows)
|
||||
{
|
||||
return (BuildManager.BuildTool) EditorSettings.GetSetting("mono/builds/build_tool")
|
||||
return (BuildManager.BuildTool)EditorSettings.GetSetting("mono/builds/build_tool")
|
||||
== BuildManager.BuildTool.MsBuildMono;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace GodotTools.Build
|
|||
}
|
||||
|
||||
private static bool PrintBuildOutput =>
|
||||
(bool) EditorSettings.GetSetting("mono/builds/print_build_output");
|
||||
(bool)EditorSettings.GetSetting("mono/builds/print_build_output");
|
||||
|
||||
private static Process LaunchBuild(string solution, string config, string loggerOutputDir, IEnumerable<string> customProperties = null)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ namespace GodotTools.Build
|
|||
// Needed when running from Developer Command Prompt for VS
|
||||
RemovePlatformVariable(startInfo.EnvironmentVariables);
|
||||
|
||||
var process = new Process {StartInfo = startInfo};
|
||||
var process = new Process { StartInfo = startInfo };
|
||||
|
||||
process.Start();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace GodotTools.Build
|
|||
public static string FindMsBuild()
|
||||
{
|
||||
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
|
||||
var buildTool = (BuildManager.BuildTool) editorSettings.GetSetting("mono/builds/build_tool");
|
||||
var buildTool = (BuildManager.BuildTool)editorSettings.GetSetting("mono/builds/build_tool");
|
||||
|
||||
if (OS.IsWindows)
|
||||
{
|
||||
|
@ -136,11 +136,11 @@ namespace GodotTools.Build
|
|||
string vsWherePath = Environment.GetEnvironmentVariable(Internal.GodotIs32Bits() ? "ProgramFiles" : "ProgramFiles(x86)");
|
||||
vsWherePath += "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
|
||||
|
||||
var vsWhereArgs = new[] {"-latest", "-products", "*", "-requires", "Microsoft.Component.MSBuild"};
|
||||
var vsWhereArgs = new[] { "-latest", "-products", "*", "-requires", "Microsoft.Component.MSBuild" };
|
||||
|
||||
var outputArray = new Godot.Collections.Array<string>();
|
||||
int exitCode = Godot.OS.Execute(vsWherePath, vsWhereArgs,
|
||||
blocking: true, output: (Godot.Collections.Array) outputArray);
|
||||
blocking: true, output: (Godot.Collections.Array)outputArray);
|
||||
|
||||
if (exitCode != 0)
|
||||
return string.Empty;
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace GodotTools
|
|||
}
|
||||
|
||||
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
|
||||
var buildTool = (BuildTool) editorSettings.GetSetting("mono/builds/build_tool");
|
||||
var buildTool = (BuildTool)editorSettings.GetSetting("mono/builds/build_tool");
|
||||
|
||||
using (var pr = new EditorProgress("mono_project_debug_build", "Building project solution...", 1))
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace GodotTools
|
|||
throw new IndexOutOfRangeException("Item list index out of range");
|
||||
|
||||
// Get correct issue idx from issue list
|
||||
int issueIndex = (int) issuesList.GetItemMetadata(idx);
|
||||
int issueIndex = (int)issuesList.GetItemMetadata(idx);
|
||||
|
||||
if (idx < 0 || idx >= issues.Count)
|
||||
throw new IndexOutOfRangeException("Issue index out of range");
|
||||
|
@ -134,7 +134,7 @@ namespace GodotTools
|
|||
|
||||
if (file.StartsWith("res://"))
|
||||
{
|
||||
var script = (Script) ResourceLoader.Load(file, typeHint: Internal.CSharpLanguageType);
|
||||
var script = (Script)ResourceLoader.Load(file, typeHint: Internal.CSharpLanguageType);
|
||||
|
||||
if (script != null && Internal.ScriptEditorEdit(script, issue.Line, issue.Column))
|
||||
Internal.EditorNodeShowScriptScreen();
|
||||
|
@ -220,7 +220,7 @@ namespace GodotTools
|
|||
|
||||
issuesList.Clear();
|
||||
|
||||
var issue = new BuildIssue {Message = cause, Warning = false};
|
||||
var issue = new BuildIssue { Message = cause, Warning = false };
|
||||
|
||||
ErrorCount += 1;
|
||||
issues.Add(issue);
|
||||
|
@ -250,7 +250,7 @@ namespace GodotTools
|
|||
{
|
||||
base._Ready();
|
||||
|
||||
issuesList = new ItemList {SizeFlagsVertical = (int) SizeFlags.ExpandFill};
|
||||
issuesList = new ItemList { SizeFlagsVertical = (int)SizeFlags.ExpandFill };
|
||||
issuesList.Connect("item_activated", this, nameof(_IssueActivated));
|
||||
AddChild(issuesList);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace GodotTools
|
|||
|
||||
public static void AddItem(string projectPath, string itemType, string include)
|
||||
{
|
||||
if (!(bool) GlobalDef("mono/project/auto_update_project", true))
|
||||
if (!(bool)GlobalDef("mono/project/auto_update_project", true))
|
||||
return;
|
||||
|
||||
ProjectUtils.AddItemToProjectChecked(projectPath, itemType, include);
|
||||
|
@ -49,7 +49,7 @@ namespace GodotTools
|
|||
private static ulong ConvertToTimestamp(this DateTime value)
|
||||
{
|
||||
TimeSpan elapsedTime = value - Epoch;
|
||||
return (ulong) elapsedTime.TotalSeconds;
|
||||
return (ulong)elapsedTime.TotalSeconds;
|
||||
}
|
||||
|
||||
public static void GenerateScriptsMetadata(string projectPath, string outputPath)
|
||||
|
@ -68,7 +68,7 @@ namespace GodotTools
|
|||
|
||||
if (oldDict.TryGetValue(projectIncludeFile, out var oldFileVar))
|
||||
{
|
||||
var oldFileDict = (Dictionary) oldFileVar;
|
||||
var oldFileDict = (Dictionary)oldFileVar;
|
||||
|
||||
if (ulong.TryParse(oldFileDict["modified_time"] as string, out ulong storedModifiedTime))
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ namespace GodotTools
|
|||
if (classDict.Count == 0)
|
||||
continue; // Not found
|
||||
|
||||
newDict[projectIncludeFile] = new Dictionary {["modified_time"] = $"{modifiedTime}", ["class"] = classDict};
|
||||
newDict[projectIncludeFile] = new Dictionary { ["modified_time"] = $"{modifiedTime}", ["class"] = classDict };
|
||||
}
|
||||
|
||||
if (newDict.Count > 0)
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace GodotTools.Export
|
|||
|
||||
// TODO What if the source file is not part of the game's C# project
|
||||
|
||||
bool includeScriptsContent = (bool) ProjectSettings.GetSetting("mono/export/include_scripts_content");
|
||||
bool includeScriptsContent = (bool)ProjectSettings.GetSetting("mono/export/include_scripts_content");
|
||||
|
||||
if (!includeScriptsContent)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ namespace GodotTools.Export
|
|||
|
||||
var dependencies = new Godot.Collections.Dictionary<string, string>();
|
||||
|
||||
var projectDllName = (string) ProjectSettings.GetSetting("application/config/name");
|
||||
var projectDllName = (string)ProjectSettings.GetSetting("application/config/name");
|
||||
if (projectDllName.Empty())
|
||||
{
|
||||
projectDllName = "UnnamedProject";
|
||||
|
@ -147,7 +147,7 @@ namespace GodotTools.Export
|
|||
string apiConfig = isDebug ? "Debug" : "Release";
|
||||
string resAssembliesDir = Path.Combine(GodotSharpDirs.ResAssembliesBaseDir, apiConfig);
|
||||
|
||||
bool assembliesInsidePck = (bool) ProjectSettings.GetSetting("mono/export/export_assemblies_inside_pck") || outputDataDir == null;
|
||||
bool assembliesInsidePck = (bool)ProjectSettings.GetSetting("mono/export/export_assemblies_inside_pck") || outputDataDir == null;
|
||||
|
||||
if (!assembliesInsidePck)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ namespace GodotTools.Export
|
|||
|
||||
// AOT
|
||||
|
||||
if ((bool) ProjectSettings.GetSetting("mono/export/aot/enabled"))
|
||||
if ((bool)ProjectSettings.GetSetting("mono/export/aot/enabled"))
|
||||
{
|
||||
AotCompileDependencies(features, platform, isDebug, outputDir, outputDataDir, dependencies);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ namespace GodotTools.Export
|
|||
|
||||
AotCompileAssembly(platform, isDebug, data, assemblyPath, outputFilePathForThisAbi);
|
||||
|
||||
AddSharedObject(outputFilePathForThisAbi, tags: new[] {abi});
|
||||
AddSharedObject(outputFilePathForThisAbi, tags: new[] { abi });
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -377,7 +377,7 @@ namespace GodotTools.Export
|
|||
|
||||
string compilerCommand = Path.Combine(monoCrossBin, $"{toolPrefix}{monoExeName}{exeExt}");
|
||||
|
||||
bool fullAot = (bool) ProjectSettings.GetSetting("mono/export/aot/full_aot");
|
||||
bool fullAot = (bool)ProjectSettings.GetSetting("mono/export/aot/full_aot");
|
||||
|
||||
string EscapeOption(string option) => option.Contains(',') ? $"\"{option}\"" : option;
|
||||
string OptionsToString(IEnumerable<string> options) => string.Join(",", options.Select(EscapeOption));
|
||||
|
@ -394,7 +394,7 @@ namespace GodotTools.Export
|
|||
{
|
||||
string abi = data["abi"];
|
||||
|
||||
string androidToolchain = (string) ProjectSettings.GetSetting("mono/export/aot/android_toolchain_path");
|
||||
string androidToolchain = (string)ProjectSettings.GetSetting("mono/export/aot/android_toolchain_path");
|
||||
|
||||
if (string.IsNullOrEmpty(androidToolchain))
|
||||
{
|
||||
|
@ -419,13 +419,13 @@ namespace GodotTools.Export
|
|||
aotOptions.Add("tool-prefix=" + Path.Combine(androidToolchain, "bin", androidToolPrefixes[abi]));
|
||||
|
||||
string triple = GetAndroidTriple(abi);
|
||||
aotOptions.Add ($"mtriple={triple}");
|
||||
aotOptions.Add($"mtriple={triple}");
|
||||
}
|
||||
|
||||
aotOptions.Add($"outfile={outputFilePath}");
|
||||
|
||||
var extraAotOptions = (string[]) ProjectSettings.GetSetting("mono/export/aot/extra_aot_options");
|
||||
var extraOptimizerOptions = (string[]) ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options");
|
||||
var extraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options");
|
||||
var extraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options");
|
||||
|
||||
if (extraAotOptions.Length > 0)
|
||||
aotOptions.AddRange(extraAotOptions);
|
||||
|
@ -575,7 +575,7 @@ namespace GodotTools.Export
|
|||
private static bool PlatformHasTemplateDir(string platform)
|
||||
{
|
||||
// OSX export templates are contained in a zip, so we place our custom template inside it and let Godot do the rest.
|
||||
return !new[] {OS.Platforms.OSX, OS.Platforms.Android, OS.Platforms.HTML5}.Contains(platform);
|
||||
return !new[] { OS.Platforms.OSX, OS.Platforms.Android, OS.Platforms.HTML5 }.Contains(platform);
|
||||
}
|
||||
|
||||
private static string DeterminePlatformFromFeatures(IEnumerable<string> features)
|
||||
|
@ -623,7 +623,7 @@ namespace GodotTools.Export
|
|||
/// </summary>
|
||||
private static bool PlatformRequiresCustomBcl(string platform)
|
||||
{
|
||||
if (new[] {OS.Platforms.Android, OS.Platforms.HTML5}.Contains(platform))
|
||||
if (new[] { OS.Platforms.Android, OS.Platforms.HTML5 }.Contains(platform))
|
||||
return true;
|
||||
|
||||
// The 'net_4_x' BCL is not compatible between Windows and the other platforms.
|
||||
|
@ -663,7 +663,7 @@ namespace GodotTools.Export
|
|||
{
|
||||
get
|
||||
{
|
||||
var appName = (string) ProjectSettings.GetSetting("application/config/name");
|
||||
var appName = (string)ProjectSettings.GetSetting("application/config/name");
|
||||
string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false);
|
||||
return $"data_{appNameSafe}";
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace GodotTools
|
|||
string resourceDir = ProjectSettings.GlobalizePath("res://");
|
||||
|
||||
string path = resourceDir;
|
||||
string name = (string) ProjectSettings.GetSetting("application/config/name");
|
||||
string name = (string)ProjectSettings.GetSetting("application/config/name");
|
||||
if (name.Empty())
|
||||
name = "UnnamedProject";
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace GodotTools
|
|||
{
|
||||
Guid = guid,
|
||||
PathRelativeToSolution = name + ".csproj",
|
||||
Configs = new List<string> {"Debug", "Release", "Tools"}
|
||||
Configs = new List<string> { "Debug", "Release", "Tools" }
|
||||
};
|
||||
|
||||
solution.AddNewProject(name, projectInfo);
|
||||
|
@ -110,20 +110,20 @@ namespace GodotTools
|
|||
|
||||
private void _RemoveCreateSlnMenuOption()
|
||||
{
|
||||
menuPopup.RemoveItem(menuPopup.GetItemIndex((int) MenuOptions.CreateSln));
|
||||
menuPopup.RemoveItem(menuPopup.GetItemIndex((int)MenuOptions.CreateSln));
|
||||
bottomPanelBtn.Show();
|
||||
}
|
||||
|
||||
private void _ShowAboutDialog()
|
||||
{
|
||||
bool showOnStart = (bool) editorSettings.GetSetting("mono/editor/show_info_on_start");
|
||||
bool showOnStart = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start");
|
||||
aboutDialogCheckBox.Pressed = showOnStart;
|
||||
aboutDialog.PopupCenteredMinsize();
|
||||
}
|
||||
|
||||
private void _ToggleAboutDialogOnStart(bool enabled)
|
||||
{
|
||||
bool showOnStart = (bool) editorSettings.GetSetting("mono/editor/show_info_on_start");
|
||||
bool showOnStart = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start");
|
||||
if (showOnStart != enabled)
|
||||
editorSettings.SetSetting("mono/editor/show_info_on_start", enabled);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ namespace GodotTools
|
|||
|
||||
if (what == NotificationReady)
|
||||
{
|
||||
bool showInfoDialog = (bool) editorSettings.GetSetting("mono/editor/show_info_on_start");
|
||||
bool showInfoDialog = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start");
|
||||
if (showInfoDialog)
|
||||
{
|
||||
aboutDialog.PopupExclusive = true;
|
||||
|
@ -194,7 +194,7 @@ namespace GodotTools
|
|||
[UsedImplicitly]
|
||||
public Error OpenInExternalEditor(Script script, int line, int col)
|
||||
{
|
||||
var editor = (ExternalEditorId) editorSettings.GetSetting("mono/editor/external_editor");
|
||||
var editor = (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor");
|
||||
|
||||
switch (editor)
|
||||
{
|
||||
|
@ -318,7 +318,7 @@ namespace GodotTools
|
|||
[UsedImplicitly]
|
||||
public bool OverridesExternalEditor()
|
||||
{
|
||||
return (ExternalEditorId) editorSettings.GetSetting("mono/editor/external_editor") != ExternalEditorId.None;
|
||||
return (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor") != ExternalEditorId.None;
|
||||
}
|
||||
|
||||
public override bool Build()
|
||||
|
@ -346,7 +346,7 @@ namespace GodotTools
|
|||
|
||||
bottomPanelBtn = AddControlToBottomPanel(BottomPanel, "Mono".TTR());
|
||||
|
||||
AddChild(new HotReloadAssemblyWatcher {Name = "HotReloadAssemblyWatcher"});
|
||||
AddChild(new HotReloadAssemblyWatcher { Name = "HotReloadAssemblyWatcher" });
|
||||
|
||||
menuPopup = new PopupMenu();
|
||||
menuPopup.Hide();
|
||||
|
@ -356,7 +356,7 @@ namespace GodotTools
|
|||
|
||||
// TODO: Remove or edit this info dialog once Mono support is no longer in alpha
|
||||
{
|
||||
menuPopup.AddItem("About C# support".TTR(), (int) MenuOptions.AboutCSharp);
|
||||
menuPopup.AddItem("About C# support".TTR(), (int)MenuOptions.AboutCSharp);
|
||||
aboutDialog = new AcceptDialog();
|
||||
editorBaseControl.AddChild(aboutDialog);
|
||||
aboutDialog.WindowTitle = "Important: C# support is not feature-complete";
|
||||
|
@ -379,7 +379,7 @@ namespace GodotTools
|
|||
var aboutLabel = new Label();
|
||||
aboutHBox.AddChild(aboutLabel);
|
||||
aboutLabel.RectMinSize = new Vector2(600, 150) * EditorScale;
|
||||
aboutLabel.SizeFlagsVertical = (int) Control.SizeFlags.ExpandFill;
|
||||
aboutLabel.SizeFlagsVertical = (int)Control.SizeFlags.ExpandFill;
|
||||
aboutLabel.Autowrap = true;
|
||||
aboutLabel.Text =
|
||||
"C# support in Godot Engine is in late alpha stage and, while already usable, " +
|
||||
|
@ -394,7 +394,7 @@ namespace GodotTools
|
|||
EditorDef("mono/editor/show_info_on_start", true);
|
||||
|
||||
// CheckBox in main container
|
||||
aboutDialogCheckBox = new CheckBox {Text = "Show this warning when starting the editor"};
|
||||
aboutDialogCheckBox = new CheckBox { Text = "Show this warning when starting the editor" };
|
||||
aboutDialogCheckBox.Connect("toggled", this, nameof(_ToggleAboutDialogOnStart));
|
||||
aboutVBox.AddChild(aboutDialogCheckBox);
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ namespace GodotTools
|
|||
else
|
||||
{
|
||||
bottomPanelBtn.Hide();
|
||||
menuPopup.AddItem("Create C# solution".TTR(), (int) MenuOptions.CreateSln);
|
||||
menuPopup.AddItem("Create C# solution".TTR(), (int)MenuOptions.CreateSln);
|
||||
}
|
||||
|
||||
menuPopup.Connect("id_pressed", this, nameof(_MenuOptionPressed));
|
||||
|
@ -428,22 +428,22 @@ namespace GodotTools
|
|||
|
||||
if (OS.IsWindows)
|
||||
{
|
||||
settingsHintStr += $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider:{(int) ExternalEditorId.Rider}";
|
||||
settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider:{(int)ExternalEditorId.Rider}";
|
||||
}
|
||||
else if (OS.IsOSX)
|
||||
{
|
||||
settingsHintStr += $",Visual Studio:{(int) ExternalEditorId.VisualStudioForMac}" +
|
||||
$",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider:{(int) ExternalEditorId.Rider}";
|
||||
settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" +
|
||||
$",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider:{(int)ExternalEditorId.Rider}";
|
||||
}
|
||||
else if (OS.IsUnixLike())
|
||||
{
|
||||
settingsHintStr += $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider:{(int) ExternalEditorId.Rider}";
|
||||
settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider:{(int)ExternalEditorId.Rider}";
|
||||
}
|
||||
|
||||
editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace GodotTools
|
|||
watchTimer = new Timer
|
||||
{
|
||||
OneShot = false,
|
||||
WaitTime = (float) EditorDef("mono/assembly_watch_interval_sec", 0.5)
|
||||
WaitTime = (float)EditorDef("mono/assembly_watch_interval_sec", 0.5)
|
||||
};
|
||||
watchTimer.Connect("timeout", this, nameof(TimerTimeout));
|
||||
AddChild(watchTimer);
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace GodotTools.Ides
|
|||
|
||||
private void LaunchIde()
|
||||
{
|
||||
var editor = (ExternalEditorId) GodotSharpEditor.Instance.GetEditorInterface()
|
||||
var editor = (ExternalEditorId)GodotSharpEditor.Instance.GetEditorInterface()
|
||||
.GetEditorSettings().GetSetting("mono/editor/external_editor");
|
||||
|
||||
switch (editor)
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace GodotTools.Ides
|
|||
listener = new TcpListener(new IPEndPoint(IPAddress.Loopback, port: 0));
|
||||
listener.Start();
|
||||
|
||||
int port = ((IPEndPoint) listener.Server.LocalEndPoint).Port;
|
||||
int port = ((IPEndPoint)listener.Server.LocalEndPoint).Port;
|
||||
using (var metaFileWriter = new StreamWriter(metaFile, Encoding.UTF8))
|
||||
{
|
||||
metaFileWriter.WriteLine(port);
|
||||
|
@ -57,7 +57,7 @@ namespace GodotTools.Ides
|
|||
|
||||
public void StartServer()
|
||||
{
|
||||
var serverThread = new Thread(RunServerThread) {Name = "Godot Ide Connection Server"};
|
||||
var serverThread = new Thread(RunServerThread) { Name = "Godot Ide Connection Server" };
|
||||
serverThread.Start();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -277,7 +277,7 @@ namespace GodotTools.Ides.Rider
|
|||
return new string[0];
|
||||
|
||||
if (!isMac)
|
||||
return new[] {Path.Combine(folder.FullName, searchPattern)}.Where(File.Exists).ToArray();
|
||||
return new[] { Path.Combine(folder.FullName, searchPattern) }.Where(File.Exists).ToArray();
|
||||
return folder.GetDirectories(searchPattern).Select(f => f.FullName)
|
||||
.Where(Directory.Exists).ToArray();
|
||||
}
|
||||
|
|
|
@ -9,20 +9,20 @@ namespace GodotTools.Ides.Rider
|
|||
{
|
||||
public static class RiderPathManager
|
||||
{
|
||||
private static readonly string editorPathSettingName= "mono/editor/editor_path_optional";
|
||||
private static readonly string editorPathSettingName = "mono/editor/editor_path_optional";
|
||||
|
||||
private static string GetRiderPathFromSettings()
|
||||
{
|
||||
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
|
||||
if (editorSettings.HasSetting(editorPathSettingName))
|
||||
return (string) editorSettings.GetSetting(editorPathSettingName);
|
||||
return (string)editorSettings.GetSetting(editorPathSettingName);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
|
||||
var editor = (ExternalEditorId) editorSettings.GetSetting("mono/editor/external_editor");
|
||||
var editor = (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor");
|
||||
if (editor == ExternalEditorId.Rider)
|
||||
{
|
||||
if (!editorSettings.HasSetting(editorPathSettingName))
|
||||
|
@ -37,7 +37,7 @@ namespace GodotTools.Ides.Rider
|
|||
});
|
||||
}
|
||||
|
||||
var riderPath = (string) editorSettings.GetSetting(editorPathSettingName);
|
||||
var riderPath = (string)editorSettings.GetSetting(editorPathSettingName);
|
||||
if (IsRiderAndExists(riderPath))
|
||||
{
|
||||
Globals.EditorDef(editorPathSettingName, riderPath);
|
||||
|
|
|
@ -39,10 +39,10 @@ namespace GodotTools.Internals
|
|||
foreach (var classDeclDict in classesArray)
|
||||
{
|
||||
classesList.Add(new ClassDecl(
|
||||
(string) classDeclDict["name"],
|
||||
(string) classDeclDict["namespace"],
|
||||
(bool) classDeclDict["nested"],
|
||||
(int) classDeclDict["base_count"]
|
||||
(string)classDeclDict["name"],
|
||||
(string)classDeclDict["namespace"],
|
||||
(bool)classDeclDict["nested"],
|
||||
(int)classDeclDict["base_count"]
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace GodotTools.Utils
|
|||
public static bool IsHTML5 => _isHTML5.Value;
|
||||
|
||||
private static bool? _isUnixCache;
|
||||
private static readonly string[] UnixLikePlatforms = {Names.OSX, Names.X11, Names.Server, Names.Haiku, Names.Android};
|
||||
private static readonly string[] UnixLikePlatforms = { Names.OSX, Names.X11, Names.Server, Names.Haiku, Names.Android };
|
||||
|
||||
public static bool IsUnixLike()
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ namespace GodotTools.Utils
|
|||
|
||||
process.BeginOutputReadLine();
|
||||
process.BeginErrorReadLine();
|
||||
if (IsWindows && process.Id>0)
|
||||
if (IsWindows && process.Id > 0)
|
||||
User32Dll.AllowSetForegroundWindow(process.Id); // allows application to focus itself
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="JetBrains.Annotations" version="2019.1.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
|
Loading…
Reference in a new issue