Codestyle fixes
This commit is contained in:
@@ -73,8 +73,12 @@
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CppNaming/UserRules/=TYPEDEF/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CppNaming/UserRules/=UNION/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CppNaming/UserRules/=UNION_005FMEMBER/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AI/@EntryIndexedValue">AI</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LO/@EntryIndexedValue">LO</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RPC/@EntryIndexedValue">RPC</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SDK/@EntryIndexedValue">SDK</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VS/@EntryIndexedValue">VS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FCONSTANT/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FFUNCTION/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FVARIABLE/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
|
||||
@@ -109,6 +109,8 @@ namespace FlaxEngine
|
||||
public static T[] GetScripts<T>() where T : Script
|
||||
{
|
||||
var scripts = GetScripts(typeof(T));
|
||||
if (scripts.Length == 0)
|
||||
return Array.Empty<T>();
|
||||
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.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the object.</typeparam>
|
||||
/// <typeparam name="activeOnly">Finds only active actors.</typeparam>
|
||||
/// <param name="activeOnly">Finds only active actors.</param>
|
||||
/// <returns>Found actors list.</returns>
|
||||
public static T[] GetActors<T>(bool activeOnly = false) where T : Actor
|
||||
{
|
||||
var actors = GetActors(typeof(T), activeOnly);
|
||||
if (actors.Length == 0)
|
||||
return Array.Empty<T>();
|
||||
var result = new T[actors.Length];
|
||||
for (int i = 0; i < actors.Length; i++)
|
||||
result[i] = actors[i] as T;
|
||||
|
||||
@@ -9,32 +9,30 @@ namespace Flax.Build
|
||||
/// </summary>
|
||||
public static class FileCache
|
||||
{
|
||||
private static Dictionary<string, FileInfo> fileInfoCache = new Dictionary<string, FileInfo>();
|
||||
private static readonly Dictionary<string, FileInfo> _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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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\"");
|
||||
|
||||
@@ -105,8 +105,7 @@ namespace Flax.Deps
|
||||
if (totalBytes.HasValue)
|
||||
progress.Update(totalBytesRead, totalBytes.Value);
|
||||
}
|
||||
}
|
||||
while (hasMoreToRead);
|
||||
} while (hasMoreToRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Flax.Build.Platforms
|
||||
public static readonly AndroidSdk Instance = new AndroidSdk();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override TargetPlatform[] Platforms => new []
|
||||
public override TargetPlatform[] Platforms => new[]
|
||||
{
|
||||
TargetPlatform.Windows,
|
||||
TargetPlatform.Linux,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user