1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Mono formatting

No space for casting, add spaces inside braces, 4 space indentation, remove trailing indentation, remove BOM.
This commit is contained in:
Aaron Franke
2019-12-11 08:46:28 -05:00
parent 9abc0ad8a5
commit 5771f9959c
31 changed files with 571 additions and 577 deletions

View File

@@ -18,7 +18,7 @@ namespace GodotTools.BuildLogger
if (null == Parameters) if (null == Parameters)
throw new LoggerException("Log directory was not set."); throw new LoggerException("Log directory was not set.");
var parameters = Parameters.Split(new[] {';'}); var parameters = Parameters.Split(new[] { ';' });
string logDir = parameters[0]; string logDir = parameters[0];

View File

@@ -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"> <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')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>

View File

@@ -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"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

View File

@@ -26,7 +26,7 @@ namespace GodotTools.Core
path = path.Replace('\\', '/'); 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(); path = string.Join(Path.DirectorySeparatorChar.ToString(), parts).Trim();
@@ -44,7 +44,7 @@ namespace GodotTools.Core
public static string CsvEscape(this string value, char delimiter = ',') 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) if (hasSpecialChar)
return "\"" + value.Replace("\"", "\"\"") + "\""; return "\"" + value.Replace("\"", "\"\"") + "\"";
@@ -54,7 +54,7 @@ namespace GodotTools.Core
public static string ToSafeDirName(this string dirName, bool allowDirSeparator) public static string ToSafeDirName(this string dirName, bool allowDirSeparator)
{ {
var invalidChars = new List<string> {":", "*", "?", "\"", "<", ">", "|"}; var invalidChars = new List<string> { ":", "*", "?", "\"", "<", ">", "|" };
if (allowDirSeparator) if (allowDirSeparator)
{ {

View File

@@ -201,7 +201,7 @@ namespace GodotTools.IdeConnection
clientReader?.Dispose(); clientReader?.Dispose();
clientWriter?.Dispose(); clientWriter?.Dispose();
((IDisposable) tcpClient)?.Dispose(); ((IDisposable)tcpClient)?.Dispose();
} }
} }
} }

View File

@@ -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"> <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')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>

View File

@@ -26,8 +26,8 @@ namespace GodotTools.ProjectEditor
mainGroup.SetProperty("BaseIntermediateOutputPath", "obj"); mainGroup.SetProperty("BaseIntermediateOutputPath", "obj");
GenAssemblyInfoFile(root, dir, CoreApiProjectName, GenAssemblyInfoFile(root, dir, CoreApiProjectName,
new[] {"[assembly: InternalsVisibleTo(\"" + EditorApiProjectName + "\")]"}, new[] { "[assembly: InternalsVisibleTo(\"" + EditorApiProjectName + "\")]" },
new[] {"System.Runtime.CompilerServices"}); new[] { "System.Runtime.CompilerServices" });
foreach (var item in compileItems) foreach (var item in compileItems)
{ {

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="DotNet.Glob" version="2.1.1" targetFramework="net45" /> <package id="DotNet.Glob" version="2.1.1" targetFramework="net45" />
</packages> </packages>

View File

@@ -34,7 +34,7 @@ namespace GodotTools
for (int i = 0; i < buildTabs.GetChildCount(); i++) for (int i = 0; i < buildTabs.GetChildCount(); i++)
{ {
var tab = (BuildTab) buildTabs.GetChild(i); var tab = (BuildTab)buildTabs.GetChild(i);
if (tab == null) if (tab == null)
continue; continue;
@@ -120,7 +120,7 @@ namespace GodotTools
if (currentTab < 0 || currentTab >= buildTabs.GetTabCount()) if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
throw new InvalidOperationException("No tab selected"); throw new InvalidOperationException("No tab selected");
var buildTab = (BuildTab) buildTabs.GetChild(currentTab); var buildTab = (BuildTab)buildTabs.GetChild(currentTab);
buildTab.WarningsVisible = pressed; buildTab.WarningsVisible = pressed;
buildTab.UpdateIssuesList(); buildTab.UpdateIssuesList();
} }
@@ -132,7 +132,7 @@ namespace GodotTools
if (currentTab < 0 || currentTab >= buildTabs.GetTabCount()) if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
throw new InvalidOperationException("No tab selected"); throw new InvalidOperationException("No tab selected");
var buildTab = (BuildTab) buildTabs.GetChild(currentTab); var buildTab = (BuildTab)buildTabs.GetChild(currentTab);
buildTab.ErrorsVisible = pressed; buildTab.ErrorsVisible = pressed;
buildTab.UpdateIssuesList(); buildTab.UpdateIssuesList();
} }
@@ -193,7 +193,7 @@ namespace GodotTools
int selectedItem = selectedItems[0]; 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)); OS.ShellOpen(Path.Combine(buildTab.BuildInfo.LogsDirPath, BuildManager.MsBuildLogFileName));
} }
@@ -249,14 +249,14 @@ namespace GodotTools
var editorBaseControl = editorInterface.GetBaseControl(); var editorBaseControl = editorInterface.GetBaseControl();
SizeFlagsVertical = (int) SizeFlags.ExpandFill; SizeFlagsVertical = (int)SizeFlags.ExpandFill;
SetAnchorsAndMarginsPreset(LayoutPreset.Wide); SetAnchorsAndMarginsPreset(LayoutPreset.Wide);
panelTabs = new TabContainer panelTabs = new TabContainer
{ {
TabAlign = TabContainer.TabAlignEnum.Left, TabAlign = TabContainer.TabAlignEnum.Left,
RectMinSize = new Vector2(0, 228) * EditorScale, RectMinSize = new Vector2(0, 228) * EditorScale,
SizeFlagsVertical = (int) SizeFlags.ExpandFill SizeFlagsVertical = (int)SizeFlags.ExpandFill
}; };
panelTabs.AddStyleboxOverride("panel", editorBaseControl.GetStylebox("DebuggerPanel", "EditorStyles")); panelTabs.AddStyleboxOverride("panel", editorBaseControl.GetStylebox("DebuggerPanel", "EditorStyles"));
panelTabs.AddStyleboxOverride("tab_fg", editorBaseControl.GetStylebox("DebuggerTabFG", "EditorStyles")); panelTabs.AddStyleboxOverride("tab_fg", editorBaseControl.GetStylebox("DebuggerTabFG", "EditorStyles"));
@@ -268,11 +268,11 @@ namespace GodotTools
panelBuildsTab = new VBoxContainer panelBuildsTab = new VBoxContainer
{ {
Name = "Builds".TTR(), Name = "Builds".TTR(),
SizeFlagsHorizontal = (int) SizeFlags.ExpandFill SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
}; };
panelTabs.AddChild(panelBuildsTab); panelTabs.AddChild(panelBuildsTab);
var toolBarHBox = new HBoxContainer {SizeFlagsHorizontal = (int) SizeFlags.ExpandFill}; var toolBarHBox = new HBoxContainer { SizeFlagsHorizontal = (int)SizeFlags.ExpandFill };
panelBuildsTab.AddChild(toolBarHBox); panelBuildsTab.AddChild(toolBarHBox);
var buildProjectBtn = new Button var buildProjectBtn = new Button
@@ -320,12 +320,12 @@ namespace GodotTools
var hsc = new HSplitContainer var hsc = new HSplitContainer
{ {
SizeFlagsHorizontal = (int) SizeFlags.ExpandFill, SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
SizeFlagsVertical = (int) SizeFlags.ExpandFill SizeFlagsVertical = (int)SizeFlags.ExpandFill
}; };
panelBuildsTab.AddChild(hsc); 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("item_selected", this, nameof(_BuildTabsItemSelected));
buildTabsList.Connect("nothing_selected", this, nameof(_BuildTabsNothingSelected)); buildTabsList.Connect("nothing_selected", this, nameof(_BuildTabsNothingSelected));
hsc.AddChild(buildTabsList); hsc.AddChild(buildTabsList);
@@ -333,7 +333,7 @@ namespace GodotTools
buildTabs = new TabContainer buildTabs = new TabContainer
{ {
TabAlign = TabContainer.TabAlignEnum.Left, TabAlign = TabContainer.TabAlignEnum.Left,
SizeFlagsHorizontal = (int) SizeFlags.ExpandFill, SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
TabsVisible = false TabsVisible = false
}; };
hsc.AddChild(buildTabs); hsc.AddChild(buildTabs);

View File

@@ -46,7 +46,7 @@ namespace GodotTools.Build
{ {
if (OS.IsWindows) if (OS.IsWindows)
{ {
return (BuildManager.BuildTool) EditorSettings.GetSetting("mono/builds/build_tool") return (BuildManager.BuildTool)EditorSettings.GetSetting("mono/builds/build_tool")
== BuildManager.BuildTool.MsBuildMono; == BuildManager.BuildTool.MsBuildMono;
} }
@@ -55,7 +55,7 @@ namespace GodotTools.Build
} }
private static bool PrintBuildOutput => 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) 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 // Needed when running from Developer Command Prompt for VS
RemovePlatformVariable(startInfo.EnvironmentVariables); RemovePlatformVariable(startInfo.EnvironmentVariables);
var process = new Process {StartInfo = startInfo}; var process = new Process { StartInfo = startInfo };
process.Start(); process.Start();

View File

@@ -19,7 +19,7 @@ namespace GodotTools.Build
public static string FindMsBuild() public static string FindMsBuild()
{ {
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings(); 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) if (OS.IsWindows)
{ {
@@ -136,11 +136,11 @@ namespace GodotTools.Build
string vsWherePath = Environment.GetEnvironmentVariable(Internal.GodotIs32Bits() ? "ProgramFiles" : "ProgramFiles(x86)"); string vsWherePath = Environment.GetEnvironmentVariable(Internal.GodotIs32Bits() ? "ProgramFiles" : "ProgramFiles(x86)");
vsWherePath += "\\Microsoft Visual Studio\\Installer\\vswhere.exe"; 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>(); var outputArray = new Godot.Collections.Array<string>();
int exitCode = Godot.OS.Execute(vsWherePath, vsWhereArgs, int exitCode = Godot.OS.Execute(vsWherePath, vsWhereArgs,
blocking: true, output: (Godot.Collections.Array) outputArray); blocking: true, output: (Godot.Collections.Array)outputArray);
if (exitCode != 0) if (exitCode != 0)
return string.Empty; return string.Empty;

View File

@@ -172,7 +172,7 @@ namespace GodotTools
} }
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings(); 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)) using (var pr = new EditorProgress("mono_project_debug_build", "Building project solution...", 1))
{ {

View File

@@ -113,7 +113,7 @@ namespace GodotTools
throw new IndexOutOfRangeException("Item list index out of range"); throw new IndexOutOfRangeException("Item list index out of range");
// Get correct issue idx from issue list // 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) if (idx < 0 || idx >= issues.Count)
throw new IndexOutOfRangeException("Issue index out of range"); throw new IndexOutOfRangeException("Issue index out of range");
@@ -134,7 +134,7 @@ namespace GodotTools
if (file.StartsWith("res://")) 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)) if (script != null && Internal.ScriptEditorEdit(script, issue.Line, issue.Column))
Internal.EditorNodeShowScriptScreen(); Internal.EditorNodeShowScriptScreen();
@@ -220,7 +220,7 @@ namespace GodotTools
issuesList.Clear(); issuesList.Clear();
var issue = new BuildIssue {Message = cause, Warning = false}; var issue = new BuildIssue { Message = cause, Warning = false };
ErrorCount += 1; ErrorCount += 1;
issues.Add(issue); issues.Add(issue);
@@ -250,7 +250,7 @@ namespace GodotTools
{ {
base._Ready(); base._Ready();
issuesList = new ItemList {SizeFlagsVertical = (int) SizeFlags.ExpandFill}; issuesList = new ItemList { SizeFlagsVertical = (int)SizeFlags.ExpandFill };
issuesList.Connect("item_activated", this, nameof(_IssueActivated)); issuesList.Connect("item_activated", this, nameof(_IssueActivated));
AddChild(issuesList); AddChild(issuesList);
} }

View File

@@ -26,7 +26,7 @@ namespace GodotTools
public static void AddItem(string projectPath, string itemType, string include) 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; return;
ProjectUtils.AddItemToProjectChecked(projectPath, itemType, include); ProjectUtils.AddItemToProjectChecked(projectPath, itemType, include);
@@ -49,7 +49,7 @@ namespace GodotTools
private static ulong ConvertToTimestamp(this DateTime value) private static ulong ConvertToTimestamp(this DateTime value)
{ {
TimeSpan elapsedTime = value - Epoch; TimeSpan elapsedTime = value - Epoch;
return (ulong) elapsedTime.TotalSeconds; return (ulong)elapsedTime.TotalSeconds;
} }
public static void GenerateScriptsMetadata(string projectPath, string outputPath) public static void GenerateScriptsMetadata(string projectPath, string outputPath)
@@ -68,7 +68,7 @@ namespace GodotTools
if (oldDict.TryGetValue(projectIncludeFile, out var oldFileVar)) 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)) if (ulong.TryParse(oldFileDict["modified_time"] as string, out ulong storedModifiedTime))
{ {
@@ -108,7 +108,7 @@ namespace GodotTools
if (classDict.Count == 0) if (classDict.Count == 0)
continue; // Not found 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) if (newDict.Count > 0)

View File

@@ -54,7 +54,7 @@ namespace GodotTools.Export
// TODO What if the source file is not part of the game's C# project // 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) if (!includeScriptsContent)
{ {
@@ -114,7 +114,7 @@ namespace GodotTools.Export
var dependencies = new Godot.Collections.Dictionary<string, string>(); 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()) if (projectDllName.Empty())
{ {
projectDllName = "UnnamedProject"; projectDllName = "UnnamedProject";
@@ -147,7 +147,7 @@ namespace GodotTools.Export
string apiConfig = isDebug ? "Debug" : "Release"; string apiConfig = isDebug ? "Debug" : "Release";
string resAssembliesDir = Path.Combine(GodotSharpDirs.ResAssembliesBaseDir, apiConfig); 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) if (!assembliesInsidePck)
{ {
@@ -174,7 +174,7 @@ namespace GodotTools.Export
// AOT // AOT
if ((bool) ProjectSettings.GetSetting("mono/export/aot/enabled")) if ((bool)ProjectSettings.GetSetting("mono/export/aot/enabled"))
{ {
AotCompileDependencies(features, platform, isDebug, outputDir, outputDataDir, dependencies); AotCompileDependencies(features, platform, isDebug, outputDir, outputDataDir, dependencies);
} }
@@ -336,7 +336,7 @@ namespace GodotTools.Export
AotCompileAssembly(platform, isDebug, data, assemblyPath, outputFilePathForThisAbi); AotCompileAssembly(platform, isDebug, data, assemblyPath, outputFilePathForThisAbi);
AddSharedObject(outputFilePathForThisAbi, tags: new[] {abi}); AddSharedObject(outputFilePathForThisAbi, tags: new[] { abi });
} }
} }
else else
@@ -377,7 +377,7 @@ namespace GodotTools.Export
string compilerCommand = Path.Combine(monoCrossBin, $"{toolPrefix}{monoExeName}{exeExt}"); 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 EscapeOption(string option) => option.Contains(',') ? $"\"{option}\"" : option;
string OptionsToString(IEnumerable<string> options) => string.Join(",", options.Select(EscapeOption)); string OptionsToString(IEnumerable<string> options) => string.Join(",", options.Select(EscapeOption));
@@ -394,7 +394,7 @@ namespace GodotTools.Export
{ {
string abi = data["abi"]; 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)) if (string.IsNullOrEmpty(androidToolchain))
{ {
@@ -419,13 +419,13 @@ namespace GodotTools.Export
aotOptions.Add("tool-prefix=" + Path.Combine(androidToolchain, "bin", androidToolPrefixes[abi])); aotOptions.Add("tool-prefix=" + Path.Combine(androidToolchain, "bin", androidToolPrefixes[abi]));
string triple = GetAndroidTriple(abi); string triple = GetAndroidTriple(abi);
aotOptions.Add ($"mtriple={triple}"); aotOptions.Add($"mtriple={triple}");
} }
aotOptions.Add($"outfile={outputFilePath}"); aotOptions.Add($"outfile={outputFilePath}");
var extraAotOptions = (string[]) ProjectSettings.GetSetting("mono/export/aot/extra_aot_options"); var extraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options");
var extraOptimizerOptions = (string[]) ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options"); var extraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options");
if (extraAotOptions.Length > 0) if (extraAotOptions.Length > 0)
aotOptions.AddRange(extraAotOptions); aotOptions.AddRange(extraAotOptions);
@@ -575,7 +575,7 @@ namespace GodotTools.Export
private static bool PlatformHasTemplateDir(string platform) 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. // 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) private static string DeterminePlatformFromFeatures(IEnumerable<string> features)
@@ -623,7 +623,7 @@ namespace GodotTools.Export
/// </summary> /// </summary>
private static bool PlatformRequiresCustomBcl(string platform) 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; return true;
// The 'net_4_x' BCL is not compatible between Windows and the other platforms. // The 'net_4_x' BCL is not compatible between Windows and the other platforms.
@@ -663,7 +663,7 @@ namespace GodotTools.Export
{ {
get get
{ {
var appName = (string) ProjectSettings.GetSetting("application/config/name"); var appName = (string)ProjectSettings.GetSetting("application/config/name");
string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false); string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false);
return $"data_{appNameSafe}"; return $"data_{appNameSafe}";
} }

View File

@@ -44,7 +44,7 @@ namespace GodotTools
string resourceDir = ProjectSettings.GlobalizePath("res://"); string resourceDir = ProjectSettings.GlobalizePath("res://");
string path = resourceDir; string path = resourceDir;
string name = (string) ProjectSettings.GetSetting("application/config/name"); string name = (string)ProjectSettings.GetSetting("application/config/name");
if (name.Empty()) if (name.Empty())
name = "UnnamedProject"; name = "UnnamedProject";
@@ -61,7 +61,7 @@ namespace GodotTools
{ {
Guid = guid, Guid = guid,
PathRelativeToSolution = name + ".csproj", PathRelativeToSolution = name + ".csproj",
Configs = new List<string> {"Debug", "Release", "Tools"} Configs = new List<string> { "Debug", "Release", "Tools" }
}; };
solution.AddNewProject(name, projectInfo); solution.AddNewProject(name, projectInfo);
@@ -110,20 +110,20 @@ namespace GodotTools
private void _RemoveCreateSlnMenuOption() private void _RemoveCreateSlnMenuOption()
{ {
menuPopup.RemoveItem(menuPopup.GetItemIndex((int) MenuOptions.CreateSln)); menuPopup.RemoveItem(menuPopup.GetItemIndex((int)MenuOptions.CreateSln));
bottomPanelBtn.Show(); bottomPanelBtn.Show();
} }
private void _ShowAboutDialog() 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; aboutDialogCheckBox.Pressed = showOnStart;
aboutDialog.PopupCenteredMinsize(); aboutDialog.PopupCenteredMinsize();
} }
private void _ToggleAboutDialogOnStart(bool enabled) 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) if (showOnStart != enabled)
editorSettings.SetSetting("mono/editor/show_info_on_start", enabled); editorSettings.SetSetting("mono/editor/show_info_on_start", enabled);
} }
@@ -160,7 +160,7 @@ namespace GodotTools
if (what == NotificationReady) 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) if (showInfoDialog)
{ {
aboutDialog.PopupExclusive = true; aboutDialog.PopupExclusive = true;
@@ -194,7 +194,7 @@ namespace GodotTools
[UsedImplicitly] [UsedImplicitly]
public Error OpenInExternalEditor(Script script, int line, int col) 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) switch (editor)
{ {
@@ -318,7 +318,7 @@ namespace GodotTools
[UsedImplicitly] [UsedImplicitly]
public bool OverridesExternalEditor() 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() public override bool Build()
@@ -346,7 +346,7 @@ namespace GodotTools
bottomPanelBtn = AddControlToBottomPanel(BottomPanel, "Mono".TTR()); bottomPanelBtn = AddControlToBottomPanel(BottomPanel, "Mono".TTR());
AddChild(new HotReloadAssemblyWatcher {Name = "HotReloadAssemblyWatcher"}); AddChild(new HotReloadAssemblyWatcher { Name = "HotReloadAssemblyWatcher" });
menuPopup = new PopupMenu(); menuPopup = new PopupMenu();
menuPopup.Hide(); menuPopup.Hide();
@@ -356,7 +356,7 @@ namespace GodotTools
// TODO: Remove or edit this info dialog once Mono support is no longer in alpha // 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(); aboutDialog = new AcceptDialog();
editorBaseControl.AddChild(aboutDialog); editorBaseControl.AddChild(aboutDialog);
aboutDialog.WindowTitle = "Important: C# support is not feature-complete"; aboutDialog.WindowTitle = "Important: C# support is not feature-complete";
@@ -379,7 +379,7 @@ namespace GodotTools
var aboutLabel = new Label(); var aboutLabel = new Label();
aboutHBox.AddChild(aboutLabel); aboutHBox.AddChild(aboutLabel);
aboutLabel.RectMinSize = new Vector2(600, 150) * EditorScale; aboutLabel.RectMinSize = new Vector2(600, 150) * EditorScale;
aboutLabel.SizeFlagsVertical = (int) Control.SizeFlags.ExpandFill; aboutLabel.SizeFlagsVertical = (int)Control.SizeFlags.ExpandFill;
aboutLabel.Autowrap = true; aboutLabel.Autowrap = true;
aboutLabel.Text = aboutLabel.Text =
"C# support in Godot Engine is in late alpha stage and, while already usable, " + "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); EditorDef("mono/editor/show_info_on_start", true);
// CheckBox in main container // 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)); aboutDialogCheckBox.Connect("toggled", this, nameof(_ToggleAboutDialogOnStart));
aboutVBox.AddChild(aboutDialogCheckBox); aboutVBox.AddChild(aboutDialogCheckBox);
} }
@@ -407,7 +407,7 @@ namespace GodotTools
else else
{ {
bottomPanelBtn.Hide(); 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)); menuPopup.Connect("id_pressed", this, nameof(_MenuOptionPressed));
@@ -428,22 +428,22 @@ namespace GodotTools
if (OS.IsWindows) if (OS.IsWindows)
{ {
settingsHintStr += $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" + settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
$",JetBrains Rider:{(int) ExternalEditorId.Rider}"; $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
} }
else if (OS.IsOSX) else if (OS.IsOSX)
{ {
settingsHintStr += $",Visual Studio:{(int) ExternalEditorId.VisualStudioForMac}" + settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" +
$",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" + $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
$",JetBrains Rider:{(int) ExternalEditorId.Rider}"; $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
} }
else if (OS.IsUnixLike()) else if (OS.IsUnixLike())
{ {
settingsHintStr += $",MonoDevelop:{(int) ExternalEditorId.MonoDevelop}" + settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code:{(int) ExternalEditorId.VsCode}" + $",Visual Studio Code:{(int)ExternalEditorId.VsCode}" +
$",JetBrains Rider:{(int) ExternalEditorId.Rider}"; $",JetBrains Rider:{(int)ExternalEditorId.Rider}";
} }
editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary

View File

@@ -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"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

View File

@@ -38,7 +38,7 @@ namespace GodotTools
watchTimer = new Timer watchTimer = new Timer
{ {
OneShot = false, 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)); watchTimer.Connect("timeout", this, nameof(TimerTimeout));
AddChild(watchTimer); AddChild(watchTimer);

View File

@@ -64,7 +64,7 @@ namespace GodotTools.Ides
private void LaunchIde() private void LaunchIde()
{ {
var editor = (ExternalEditorId) GodotSharpEditor.Instance.GetEditorInterface() var editor = (ExternalEditorId)GodotSharpEditor.Instance.GetEditorInterface()
.GetEditorSettings().GetSetting("mono/editor/external_editor"); .GetEditorSettings().GetSetting("mono/editor/external_editor");
switch (editor) switch (editor)

View File

@@ -45,7 +45,7 @@ namespace GodotTools.Ides
listener = new TcpListener(new IPEndPoint(IPAddress.Loopback, port: 0)); listener = new TcpListener(new IPEndPoint(IPAddress.Loopback, port: 0));
listener.Start(); listener.Start();
int port = ((IPEndPoint) listener.Server.LocalEndPoint).Port; int port = ((IPEndPoint)listener.Server.LocalEndPoint).Port;
using (var metaFileWriter = new StreamWriter(metaFile, Encoding.UTF8)) using (var metaFileWriter = new StreamWriter(metaFile, Encoding.UTF8))
{ {
metaFileWriter.WriteLine(port); metaFileWriter.WriteLine(port);
@@ -57,7 +57,7 @@ namespace GodotTools.Ides
public void StartServer() 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(); serverThread.Start();
} }

View File

@@ -1,6 +0,0 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -277,7 +277,7 @@ namespace GodotTools.Ides.Rider
return new string[0]; return new string[0];
if (!isMac) 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) return folder.GetDirectories(searchPattern).Select(f => f.FullName)
.Where(Directory.Exists).ToArray(); .Where(Directory.Exists).ToArray();
} }

View File

@@ -9,20 +9,20 @@ namespace GodotTools.Ides.Rider
{ {
public static class RiderPathManager 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() private static string GetRiderPathFromSettings()
{ {
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings(); var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
if (editorSettings.HasSetting(editorPathSettingName)) if (editorSettings.HasSetting(editorPathSettingName))
return (string) editorSettings.GetSetting(editorPathSettingName); return (string)editorSettings.GetSetting(editorPathSettingName);
return null; return null;
} }
public static void Initialize() public static void Initialize()
{ {
var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings(); 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 (editor == ExternalEditorId.Rider)
{ {
if (!editorSettings.HasSetting(editorPathSettingName)) 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)) if (IsRiderAndExists(riderPath))
{ {
Globals.EditorDef(editorPathSettingName, riderPath); Globals.EditorDef(editorPathSettingName, riderPath);

View File

@@ -39,10 +39,10 @@ namespace GodotTools.Internals
foreach (var classDeclDict in classesArray) foreach (var classDeclDict in classesArray)
{ {
classesList.Add(new ClassDecl( classesList.Add(new ClassDecl(
(string) classDeclDict["name"], (string)classDeclDict["name"],
(string) classDeclDict["namespace"], (string)classDeclDict["namespace"],
(bool) classDeclDict["nested"], (bool)classDeclDict["nested"],
(int) classDeclDict["base_count"] (int)classDeclDict["base_count"]
)); ));
} }

View File

@@ -75,7 +75,7 @@ namespace GodotTools.Utils
public static bool IsHTML5 => _isHTML5.Value; public static bool IsHTML5 => _isHTML5.Value;
private static bool? _isUnixCache; 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() public static bool IsUnixLike()
{ {
@@ -157,7 +157,7 @@ namespace GodotTools.Utils
process.BeginOutputReadLine(); process.BeginOutputReadLine();
process.BeginErrorReadLine(); process.BeginErrorReadLine();
if (IsWindows && process.Id>0) if (IsWindows && process.Id > 0)
User32Dll.AllowSetForegroundWindow(process.Id); // allows application to focus itself User32Dll.AllowSetForegroundWindow(process.Id); // allows application to focus itself
} }
} }

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="JetBrains.Annotations" version="2019.1.3" targetFramework="net45" /> <package id="JetBrains.Annotations" version="2019.1.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" /> <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />

View File

@@ -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"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>