Codestyle fixes

This commit is contained in:
Wojtek Figat
2024-02-19 14:59:02 +01:00
parent ed30cd0238
commit 4c082ef17f
22 changed files with 58 additions and 62 deletions

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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();
}