Fix compile errors due to Beef.Linq update

This commit is contained in:
Simon Lübeß
2026-08-16 22:21:53 +02:00
parent 2a90374b5b
commit c81e695981
4 changed files with 18 additions and 8 deletions
+1 -1
View File
@@ -497,7 +497,7 @@ class AssetHierarchy
void AddEntryToTree(String filePath, bool isDirectory, TreeNode<AssetNode> parentNode) void AddEntryToTree(String filePath, bool isDirectory, TreeNode<AssetNode> parentNode)
{ {
// Try to find the node for the specified path in the given parent // Try to find the node for the specified path in the given parent
TreeNode<AssetNode> treeNode = parentNode.Children.Where(scope (node) => node.Value.Path == filePath).FirstOrDefault(); TreeNode<AssetNode> treeNode = parentNode.Children.Where((node) => node.Value.Path == filePath).FirstOrDefault();
// If no node was found -> create one // If no node was found -> create one
if (treeNode == null) if (treeNode == null)
@@ -243,7 +243,7 @@ namespace GlitchyEditor.EditWindows
for (StringView entryName in assetCreator.Name.Split('/')) for (StringView entryName in assetCreator.Name.Split('/'))
{ {
AssetCreatorTree nextNode = tree.Children.Where(scope (node) => node->Name == entryName).FirstOrDefault(); AssetCreatorTree nextNode = tree.Children.Where((node) => node->Name == entryName).FirstOrDefault();
// Create new node if we didn't find it // Create new node if we didn't find it
nextNode ??= tree.AddChild((entryName, null)); nextNode ??= tree.AddChild((entryName, null));
@@ -720,7 +720,7 @@ namespace GlitchyEditor.EditWindows
ImGui.TreeNodeFlags flags = .OpenOnArrow | .SpanAvailWidth; ImGui.TreeNodeFlags flags = .OpenOnArrow | .SpanAvailWidth;
if(tree.Children.Where(scope (node) => node->IsDirectory).Count() == 0) if(tree.Children.Where((node) => node->IsDirectory).Count() == 0)
flags |= .Leaf; flags |= .Leaf;
if (tree->Path == CurrentDirectory) if (tree->Path == CurrentDirectory)
@@ -1390,7 +1390,7 @@ namespace GlitchyEditor.EditWindows
private void CopySelectedFiles(bool cutFiles) private void CopySelectedFiles(bool cutFiles)
{ {
_filesToCopy.ClearAndDeleteItems(); _filesToCopy.ClearAndDeleteItems();
_selectedFiles.Select(scope (file) => new String(file)).ToList(_filesToCopy); _selectedFiles.Select((file) => new String(file)).ToList(_filesToCopy);
_cutFiles = cutFiles; _cutFiles = cutFiles;
} }
+13 -3
View File
@@ -55,10 +55,20 @@ class StdDevResultColumn : IResultColumn
{ {
TimeSpan meanTime = runToCalculate.ResultColumnValue[MeanTimeResultColumn.ColumnName]; TimeSpan meanTime = runToCalculate.ResultColumnValue[MeanTimeResultColumn.ColumnName];
int64 variance = runToCalculate.RunDurations.Select(scope (d) => { // For some reason we need to specify the type arguments here.
/*int64 variance = runToCalculate.RunDurations.Sum<TimeSpan[], TimeSpan, delegate int64(TimeSpan), int64>(scope [=meanTime, =runToCalculate] (d) => {
TimeSpan delta = d - meanTime; TimeSpan delta = d - meanTime;
return (delta * delta).Ticks / runToCalculate.RunCount; return (delta * delta).Ticks / runToCalculate.RunCount;
}).Sum(); });*/
int64 variance = 0;
for (let duration in runToCalculate.RunDurations)
{
TimeSpan delta = duration - meanTime;
variance += (delta * delta).Ticks / runToCalculate.RunCount;
}
return TimeSpan((int64)Math.Sqrt((double)variance)); return TimeSpan((int64)Math.Sqrt((double)variance));
} }
} }
@@ -204,7 +214,7 @@ class BenchmarkResult
defer delete columnsToSort; defer delete columnsToSort;
columnsToSort.Sort(scope (a, b) => a.Depth <=> b.Depth); columnsToSort.Sort(scope (a, b) => a.Depth <=> b.Depth);
outColumnCalculationPlan.AddRange(columnsToSort.Select(scope (a) => a.Column)); outColumnCalculationPlan.AddRange(columnsToSort.Select((a) => a.Column));
} }
private void CalculateStats(Span<IResultColumn> customColumns) private void CalculateStats(Span<IResultColumn> customColumns)
@@ -129,7 +129,7 @@ class ScriptEngineTestBase
TimeSpan totalRunTime = _runDurations.Sum(); TimeSpan totalRunTime = _runDurations.Sum();
TimeSpan meanRunTime = TimeSpan(totalRunTime.Ticks / runs); TimeSpan meanRunTime = TimeSpan(totalRunTime.Ticks / runs);
double varianceMs = _runDurations.Select(scope (d) => Math.Pow((d - meanRunTime).TotalMilliseconds, 2)).Sum() / runs; double varianceMs = _runDurations.Select((d) => Math.Pow((d - meanRunTime).TotalMilliseconds, 2)).Sum() / runs;
TimeSpan stdDeviation = TimeSpan.FromMilliseconds(Math.Sqrt(varianceMs)); TimeSpan stdDeviation = TimeSpan.FromMilliseconds(Math.Sqrt(varianceMs));
Console.WriteLine($"Results:"); Console.WriteLine($"Results:");