diff --git a/Flax.sln.DotSettings b/Flax.sln.DotSettings
index ff396d824..80cf8fa1e 100644
--- a/Flax.sln.DotSettings
+++ b/Flax.sln.DotSettings
@@ -73,8 +73,12 @@
<Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ AI
LO
+ RPC
+ SDK
VS
+ <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
diff --git a/Source/Engine/Level/Level.cs b/Source/Engine/Level/Level.cs
index b43d9e91a..3e367195e 100644
--- a/Source/Engine/Level/Level.cs
+++ b/Source/Engine/Level/Level.cs
@@ -109,6 +109,8 @@ namespace FlaxEngine
public static T[] GetScripts() where T : Script
{
var scripts = GetScripts(typeof(T));
+ if (scripts.Length == 0)
+ return Array.Empty();
var result = new T[scripts.Length];
for (int i = 0; i < scripts.Length; i++)
result[i] = scripts[i] as T;
@@ -119,11 +121,13 @@ namespace FlaxEngine
/// Finds all the actors of the given type in all the loaded scenes.
///
/// Type of the object.
- /// Finds only active actors.
+ /// Finds only active actors.
/// Found actors list.
public static T[] GetActors(bool activeOnly = false) where T : Actor
{
var actors = GetActors(typeof(T), activeOnly);
+ if (actors.Length == 0)
+ return Array.Empty();
var result = new T[actors.Length];
for (int i = 0; i < actors.Length; i++)
result[i] = actors[i] as T;
diff --git a/Source/Tools/Flax.Build/Build/FileCache.cs b/Source/Tools/Flax.Build/Build/FileCache.cs
index a11b53415..d21e0848a 100644
--- a/Source/Tools/Flax.Build/Build/FileCache.cs
+++ b/Source/Tools/Flax.Build/Build/FileCache.cs
@@ -9,32 +9,30 @@ namespace Flax.Build
///
public static class FileCache
{
- private static Dictionary fileInfoCache = new Dictionary();
+ private static readonly Dictionary _cache = new();
public static void FileRemoveFromCache(string path)
{
- //fileInfoCache[path].Refresh();
- fileInfoCache.Remove(path);
+ _cache.Remove(path);
}
-
+
public static bool Exists(string path)
{
- if (fileInfoCache.TryGetValue(path, out var fileInfo))
+ if (_cache.TryGetValue(path, out var fileInfo))
return fileInfo.Exists;
fileInfo = new FileInfo(path);
- fileInfoCache.Add(path, fileInfo);
+ _cache.Add(path, fileInfo);
return fileInfo.Exists;
}
public static DateTime GetLastWriteTime(string path)
{
-
- if (fileInfoCache.TryGetValue(path, out var fileInfo))
+ if (_cache.TryGetValue(path, out var fileInfo))
return fileInfo.LastWriteTime;
fileInfo = new FileInfo(path);
- fileInfoCache.Add(path, fileInfo);
+ _cache.Add(path, fileInfo);
return fileInfo.LastWriteTime;
}
}
diff --git a/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs b/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
index 3efe33b38..f6586c910 100644
--- a/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
+++ b/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
@@ -808,11 +808,11 @@ namespace Flax.Build
foreach (var moduleName in moduleOptions.PrivateDependencies.Concat(moduleOptions.PublicDependencies))
{
var dependencyModule = buildData.Rules.GetModule(moduleName);
- if (dependencyModule != null &&
- !string.IsNullOrEmpty(dependencyModule.BinaryModuleName) &&
- dependencyModule.BinaryModuleName != binaryModule.Key &&
+ if (dependencyModule != null &&
+ !string.IsNullOrEmpty(dependencyModule.BinaryModuleName) &&
+ dependencyModule.BinaryModuleName != binaryModule.Key &&
!moduleNamesUsed.Contains(dependencyModule.BinaryModuleName) &&
- GetModuleProject(dependencyModule, project) != null &&
+ GetModuleProject(dependencyModule, project) != null &&
buildData.Modules.TryGetValue(dependencyModule, out var dependencyOptions))
{
// Import symbols from referenced binary module
diff --git a/Source/Tools/Flax.Build/Build/Platform.cs b/Source/Tools/Flax.Build/Build/Platform.cs
index f458225fa..6b0d48dba 100644
--- a/Source/Tools/Flax.Build/Build/Platform.cs
+++ b/Source/Tools/Flax.Build/Build/Platform.cs
@@ -77,14 +77,10 @@ namespace Flax.Build
var architectureId = RuntimeInformation.ProcessArchitecture;
switch (architectureId)
{
- case Architecture.X86:
- return TargetArchitecture.x86;
- case Architecture.X64:
- return TargetArchitecture.x64;
- case Architecture.Arm:
- return TargetArchitecture.ARM;
- case Architecture.Arm64:
- return TargetArchitecture.ARM64;
+ case Architecture.X86: return TargetArchitecture.x86;
+ case Architecture.X64: return TargetArchitecture.x64;
+ case Architecture.Arm: return TargetArchitecture.ARM;
+ case Architecture.Arm64: return TargetArchitecture.ARM64;
default: throw new NotImplementedException(string.Format("Unsupported build platform {0}.", architectureId));
}
}
@@ -290,12 +286,9 @@ namespace Flax.Build
var subdir = "Binaries/Editor/";
switch (Platform.BuildTargetPlatform)
{
- case TargetPlatform.Windows:
- return subdir + "Win64";
- case TargetPlatform.Linux:
- return subdir + "Linux";
- case TargetPlatform.Mac:
- return subdir + "Mac";
+ case TargetPlatform.Windows: return subdir + "Win64";
+ case TargetPlatform.Linux: return subdir + "Linux";
+ case TargetPlatform.Mac: return subdir + "Mac";
}
throw new NotImplementedException();
}
diff --git a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs
index e1f2ab4e6..75f43fd68 100644
--- a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs
+++ b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs
@@ -58,7 +58,7 @@ namespace Flax.Deploy
DeployFile(src, dst, buildToolExe);
CodeSign(Path.Combine(dst, buildToolExe));
var buildToolDll = "Flax.Build.dll";
- DeployFile(src, dst,buildToolDll);
+ DeployFile(src, dst, buildToolDll);
CodeSign(Path.Combine(dst, buildToolDll));
DeployFile(src, dst, "Flax.Build.xml", true);
DeployFile(src, dst, "Flax.Build.pdb");
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/Assimp.cs b/Source/Tools/Flax.Build/Deps/Dependencies/Assimp.cs
index 528256f69..bc501c3a5 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/Assimp.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/Assimp.cs
@@ -128,7 +128,7 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Mac:
{
// Build for Mac
- foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
+ foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
RunCmake(root, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + globalConfig);
Utilities.Run("make", null, null, root, Utilities.RunOptions.ThrowExceptionOnError);
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs
index 6e565b94c..bb42fc253 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs
@@ -49,7 +49,7 @@ namespace Flax.Deps.Dependencies
}
}
}
-
+
///
public override void Build(BuildOptions options)
{
@@ -185,16 +185,16 @@ namespace Flax.Deps.Dependencies
// Print the NvCloth version
Log.Info($"Building {File.ReadAllLines(Path.Combine(root, "README.md"))[0].Trim()} to {platform} {architecture}");
-
+
// Generate project files
SetupDirectory(buildFolder, false);
Utilities.FileDelete(Path.Combine(cmakeFolder, "CMakeCache.txt"));
cmakeArgs += $" -DPX_STATIC_LIBRARIES=1 -DPX_OUTPUT_DLL_DIR=\"{Path.Combine(buildFolder, "bin")}\" -DPX_OUTPUT_LIB_DIR=\"{Path.Combine(buildFolder, "lib")}\" -DPX_OUTPUT_EXE_DIR=\"{Path.Combine(buildFolder, "bin")}\"";
RunCmake(cmakeFolder, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + cmakeArgs, envVars);
-
+
// Run build
Utilities.Run("cmake", "--build . --config Release", null, cmakeFolder, Utilities.RunOptions.ThrowExceptionOnError, envVars);
-
+
// Deploy binaries
var libs = new[]
{
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/OpenAL.cs b/Source/Tools/Flax.Build/Deps/Dependencies/OpenAL.cs
index 1adb73bb3..f9f5d7ed2 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/OpenAL.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/OpenAL.cs
@@ -172,7 +172,7 @@ namespace Flax.Deps.Dependencies
var buildDir = Path.Combine(root, "build");
// Build for Mac
- foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
+ foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, architecture, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=Release " + config);
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/curl.cs b/Source/Tools/Flax.Build/Deps/Dependencies/curl.cs
index 382c5707c..651c849d8 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/curl.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/curl.cs
@@ -95,7 +95,7 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Linux:
{
// Build for Linux
- var settings = new []
+ var settings = new[]
{
"--without-librtmp",
"--without-ssl",
@@ -126,7 +126,7 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Mac:
{
// Build for Mac
- var settings = new []
+ var settings = new[]
{
"--with-secure-transport",
"--without-librtmp",
@@ -137,7 +137,7 @@ namespace Flax.Deps.Dependencies
"--enable-static",
"-disable-ldap --disable-sspi --disable-ftp --disable-file --disable-dict --disable-telnet --disable-tftp --disable-rtsp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-smb",
};
- foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
+ foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
var arch = GetAppleArchName(architecture);
var archName = arch + "-apple-darwin19";
@@ -146,7 +146,7 @@ namespace Flax.Deps.Dependencies
var compilerFlags = string.Format("-mmacosx-version-min={0} -arch {1}", Configuration.MacOSXMinVer, arch);
var envVars = new Dictionary
{
- { "CC", "clang" },
+ { "CC", "clang" },
{ "CXX", "clang" },
{ "CFLAGS", compilerFlags },
{ "CXXFLAGS", compilerFlags },
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/freetype.cs b/Source/Tools/Flax.Build/Deps/Dependencies/freetype.cs
index 165317180..6be0d3397 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/freetype.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/freetype.cs
@@ -247,7 +247,7 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Mac:
{
// Build for Mac
- foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
+ foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release");
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/glslang.cs b/Source/Tools/Flax.Build/Deps/Dependencies/glslang.cs
index f88ded6a1..5d11c4728 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/glslang.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/glslang.cs
@@ -130,7 +130,7 @@ namespace Flax.Deps.Dependencies
};
// Build for Mac
- foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
+ foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
RunCmake(root, platform, architecture, cmakeArgs);
Utilities.Run("cmake", string.Format("--build . --config {0} --target install", configuration), null, buildDir, Utilities.RunOptions.None);
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/ogg.cs b/Source/Tools/Flax.Build/Deps/Dependencies/ogg.cs
index fe6800001..4fefceb09 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/ogg.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/ogg.cs
@@ -217,7 +217,7 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Mac:
{
// Build for Mac
- foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
+ foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release");
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/vorbis.cs b/Source/Tools/Flax.Build/Deps/Dependencies/vorbis.cs
index 75b2810be..847ff8872 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/vorbis.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/vorbis.cs
@@ -376,7 +376,7 @@ namespace Flax.Deps.Dependencies
GitCheckout(oggRoot, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5");
// Build for Mac
- foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
+ foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
{
SetupDirectory(oggBuildDir, true);
RunCmake(oggBuildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
diff --git a/Source/Tools/Flax.Build/Deps/Downloader.cs b/Source/Tools/Flax.Build/Deps/Downloader.cs
index dcba01780..19135d634 100644
--- a/Source/Tools/Flax.Build/Deps/Downloader.cs
+++ b/Source/Tools/Flax.Build/Deps/Downloader.cs
@@ -105,8 +105,7 @@ namespace Flax.Deps
if (totalBytes.HasValue)
progress.Update(totalBytesRead, totalBytes.Value);
}
- }
- while (hasMoreToRead);
+ } while (hasMoreToRead);
}
}
}
diff --git a/Source/Tools/Flax.Build/Deps/ProgressDisplay.cs b/Source/Tools/Flax.Build/Deps/ProgressDisplay.cs
index 5ad6e10d3..cce10f2eb 100644
--- a/Source/Tools/Flax.Build/Deps/ProgressDisplay.cs
+++ b/Source/Tools/Flax.Build/Deps/ProgressDisplay.cs
@@ -96,7 +96,7 @@ namespace Flax.Deps
Console.WriteLine();
return false;
}
-
+
return true;
*/
}
diff --git a/Source/Tools/Flax.Build/Platforms/Android/AndroidSdk.cs b/Source/Tools/Flax.Build/Platforms/Android/AndroidSdk.cs
index a023d33b2..0fd5b6a41 100644
--- a/Source/Tools/Flax.Build/Platforms/Android/AndroidSdk.cs
+++ b/Source/Tools/Flax.Build/Platforms/Android/AndroidSdk.cs
@@ -18,7 +18,7 @@ namespace Flax.Build.Platforms
public static readonly AndroidSdk Instance = new AndroidSdk();
///
- public override TargetPlatform[] Platforms => new []
+ public override TargetPlatform[] Platforms => new[]
{
TargetPlatform.Windows,
TargetPlatform.Linux,
diff --git a/Source/Tools/Flax.Build/Platforms/Mac/MacPlatform.cs b/Source/Tools/Flax.Build/Platforms/Mac/MacPlatform.cs
index 4a8115fcd..4173e160b 100644
--- a/Source/Tools/Flax.Build/Platforms/Mac/MacPlatform.cs
+++ b/Source/Tools/Flax.Build/Platforms/Mac/MacPlatform.cs
@@ -77,15 +77,15 @@ namespace Flax.Build.Platforms
/// Returns true if running an x64 binary an arm64 host machine.
///
public unsafe static bool GetProcessIsTranslated()
- {
- int ret = 0;
- ulong size = sizeof(int);
- if (sysctlbyname("sysctl.proc_translated", &ret, &size, null, 0) == -1)
- return false;
- return ret != 0;
- }
+ {
+ int ret = 0;
+ ulong size = sizeof(int);
+ if (sysctlbyname("sysctl.proc_translated", &ret, &size, null, 0) == -1)
+ return false;
+ return ret != 0;
+ }
[DllImport("c")]
- private static unsafe extern int sysctlbyname(string name, void* oldp, ulong* oldlenp, void* newp, ulong newlen);
+ private static unsafe extern int sysctlbyname(string name, void* oldp, ulong* oldlenp, void* newp, ulong newlen);
}
}
diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs
index 3438f8960..7bd5495b2 100644
--- a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs
+++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs
@@ -702,7 +702,7 @@ namespace Flax.Build.Projects.VisualStudio
{
// Build command for the build tool
var buildToolPath = Path.ChangeExtension(typeof(Builder).Assembly.Location, null);
-
+
var targetsFileContent = new StringBuilder();
targetsFileContent.AppendLine("");
targetsFileContent.AppendLine(" ");
diff --git a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs
index 15b236972..7f3b11e15 100644
--- a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs
+++ b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs
@@ -410,8 +410,7 @@ namespace Flax.Build.Projects.VisualStudioCode
json.AddField("stopAtEntry", false);
json.AddField("externalConsole", true);
break;
- case TargetPlatform.Linux:
- break;
+ case TargetPlatform.Linux: break;
}
}
json.EndObject();
@@ -622,7 +621,7 @@ namespace Flax.Build.Projects.VisualStudioCode
json.AddField("**/Output", true);
json.AddField("**/*.flax", true);
json.EndObject();
-
+
// Extension settings
json.AddField("omnisharp.useModernNet", true);
diff --git a/Source/Tools/Flax.Build/Utilities/CppNameMangling.cs b/Source/Tools/Flax.Build/Utilities/CppNameMangling.cs
index 1d0166a72..ba00db071 100644
--- a/Source/Tools/Flax.Build/Utilities/CppNameMangling.cs
+++ b/Source/Tools/Flax.Build/Utilities/CppNameMangling.cs
@@ -79,8 +79,7 @@ namespace Flax.Build
}
}
break;
- default:
- throw new InvalidPlatformException(buildData.Platform.Target);
+ default: throw new InvalidPlatformException(buildData.Platform.Target);
}
var result = sb.ToString();
BindingsGenerator.PutStringBuilder(sb);
diff --git a/Source/Tools/Flax.Build/Utilities/WinAPI.cs b/Source/Tools/Flax.Build/Utilities/WinAPI.cs
index ae0c5a5fb..47939fc1f 100644
--- a/Source/Tools/Flax.Build/Utilities/WinAPI.cs
+++ b/Source/Tools/Flax.Build/Utilities/WinAPI.cs
@@ -130,7 +130,7 @@ namespace Flax.Build
System = 0x00001000,
Task = 0x00002000
}
-
+
public enum Icon : uint
{
Warning = 0x00000030,