diff --git a/Content.IntegrationTests/Content.IntegrationTests.csproj b/Content.IntegrationTests/Content.IntegrationTests.csproj index 71b32f8827..9d4d0aa0dd 100644 --- a/Content.IntegrationTests/Content.IntegrationTests.csproj +++ b/Content.IntegrationTests/Content.IntegrationTests.csproj @@ -8,9 +8,9 @@ 12 - - - + + + diff --git a/Content.IntegrationTests/GameTests.cs b/Content.IntegrationTests/GameTests.cs index 2f2319afba..8ccd74f02c 100644 --- a/Content.IntegrationTests/GameTests.cs +++ b/Content.IntegrationTests/GameTests.cs @@ -13,7 +13,7 @@ public sealed class GameTests : ContentIntegrationTest { public async Task NoRuntimesTest() { var (client, server) = await StartConnectedServerClientPair(); await RunTicksSync(client, server, 1000); - Assert.IsTrue(server.IsAlive); + Assert.That(server.IsAlive); var manager = server.ResolveDependency(); if(manager.LastDMException is not null) { Assert.Fail($"Runtime occurred on server boot: {manager.LastDMException}"); diff --git a/Content.IntegrationTests/SetupCompileDM.cs b/Content.IntegrationTests/SetupCompileDM.cs index f9ec1f9159..ff532c0ddb 100644 --- a/Content.IntegrationTests/SetupCompileDM.cs +++ b/Content.IntegrationTests/SetupCompileDM.cs @@ -19,7 +19,7 @@ public void Compile() { Files = new() { DmEnvironment } }); - Assert.IsTrue(successfulCompile && File.Exists(CompiledProject), "Failed to compile DM test project!"); + Assert.That(successfulCompile && File.Exists(CompiledProject), "Failed to compile DM test project!"); } [OneTimeTearDown] diff --git a/Content.Tests/Content.Tests.csproj b/Content.Tests/Content.Tests.csproj index 719446e02d..44a4f44227 100644 --- a/Content.Tests/Content.Tests.csproj +++ b/Content.Tests/Content.Tests.csproj @@ -11,10 +11,10 @@ enable - - - - + + + + diff --git a/Content.Tests/ContentUnitTest.cs b/Content.Tests/ContentUnitTest.cs index 477e8da908..c102584fb6 100644 --- a/Content.Tests/ContentUnitTest.cs +++ b/Content.Tests/ContentUnitTest.cs @@ -1,55 +1,51 @@ +using System; using System.Collections.Generic; using System.Reflection; using OpenDreamClient; using OpenDreamRuntime; +using OpenDreamRuntime.Rendering; using OpenDreamShared; +using OpenDreamShared.Rendering; using Robust.Shared.Analyzers; using Robust.Shared.IoC; using Robust.UnitTesting; using EntryPoint = OpenDreamRuntime.EntryPoint; -namespace Content.Tests -{ - [Virtual] - public class ContentUnitTest : RobustUnitTest - { - protected override void OverrideIoC() - { - base.OverrideIoC(); - - SharedOpenDreamIoC.Register(); - - if (Project == UnitTestProject.Server) - { - ServerContentIoC.Register(unitTests: true); - IoCManager.Register(); - } - else if (Project == UnitTestProject.Client) - { - ClientContentIoC.Register(); - } +namespace Content.Tests; + +[Virtual] +public class ContentUnitTest : RobustUnitTest { + protected override Type[] ExtraComponents { get; } = { + typeof(DMISpriteComponent), + typeof(DreamMobSightComponent) + }; + + protected override void OverrideIoC() { + base.OverrideIoC(); + + SharedOpenDreamIoC.Register(); + + if (Project == UnitTestProject.Server) { + ServerContentIoC.Register(unitTests: true); + IoCManager.Register(); + } else if (Project == UnitTestProject.Client) { + ClientContentIoC.Register(); } + } - protected override Assembly[] GetContentAssemblies() - { - var l = new List - { - typeof(OpenDreamShared.EntryPoint).Assembly - }; - - if (Project == UnitTestProject.Server) - { - l.Add(typeof(EntryPoint).Assembly); - } - else if (Project == UnitTestProject.Client) - { - l.Add(typeof(OpenDreamClient.EntryPoint).Assembly); - } - - l.Add(typeof(ContentUnitTest).Assembly); - - return l.ToArray(); + protected override Assembly[] GetContentAssemblies() { + var l = new List { + typeof(OpenDreamShared.EntryPoint).Assembly + }; + + if (Project == UnitTestProject.Server) { + l.Add(typeof(EntryPoint).Assembly); + } else if (Project == UnitTestProject.Client) { + l.Add(typeof(OpenDreamClient.EntryPoint).Assembly); } + + l.Add(typeof(ContentUnitTest).Assembly); + + return l.ToArray(); } } - diff --git a/Content.Tests/DMTests.cs b/Content.Tests/DMTests.cs index 59b69dde28..4fec7eba4c 100644 --- a/Content.Tests/DMTests.cs +++ b/Content.Tests/DMTests.cs @@ -5,235 +5,220 @@ using NUnit.Framework; using OpenDreamRuntime; using OpenDreamRuntime.Objects; -using OpenDreamRuntime.Rendering; -using OpenDreamShared.Rendering; using Robust.Shared.Asynchronous; -using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Timing; -// Disables warnings about using the constraint model; May need to be updated. -#pragma warning disable NUnit2002 // We use Assert.IsFalse -#pragma warning disable NUnit2003 // We use Assert.IsTrue -#pragma warning disable NUnit2010 // We do not use the constraint model -#pragma warning disable NUnit2017 // We use Assert.IsNull - -namespace Content.Tests -{ - [TestFixture] - public sealed class DMTests : ContentUnitTest { - private const string TestProject = "DMProject"; - private const string InitializeEnvironment = "./environment.dme"; - private const string TestsDirectory = "Tests"; - - [Dependency] private readonly DreamManager _dreamMan = default!; - [Dependency] private readonly DreamObjectTree _objectTree = default!; - [Dependency] private readonly ITaskManager _taskManager = default!; - - [Flags] - public enum DMTestFlags { - NoError = 0, // Should run without errors - Ignore = 1, // Ignore entirely - CompileError = 2, // Should fail to compile - RuntimeError = 4, // Should throw an exception at runtime - ReturnTrue = 8, // Should return TRUE - NoReturn = 16, // Shouldn't return (aka stopped by a stack-overflow or runtimes) - } +namespace Content.Tests; + +[TestFixture] +public sealed class DMTests : ContentUnitTest { + private const string TestProject = "DMProject"; + private const string InitializeEnvironment = "./environment.dme"; + private const string TestsDirectory = "Tests"; + + [Dependency] private readonly DreamManager _dreamMan = default!; + [Dependency] private readonly DreamObjectTree _objectTree = default!; + [Dependency] private readonly ITaskManager _taskManager = default!; + + [Flags] + public enum DMTestFlags { + NoError = 0, // Should run without errors + Ignore = 1, // Ignore entirely + CompileError = 2, // Should fail to compile + RuntimeError = 4, // Should throw an exception at runtime + ReturnTrue = 8, // Should return TRUE + NoReturn = 16, // Shouldn't return (aka stopped by a stack-overflow or runtimes) + } - private void OnException(object? sender, Exception exception) => TestContext.WriteLine(exception); - - [OneTimeSetUp] - public void OneTimeSetup() { - IoCManager.InjectDependencies(this); - _taskManager.Initialize(); - IComponentFactory componentFactory = IoCManager.Resolve(); - componentFactory.RegisterClass(); - componentFactory.RegisterClass(); //wow this is terrible TODO figure out why this is necessary - componentFactory.GenerateNetIds(); - Compile(InitializeEnvironment); - _dreamMan.PreInitialize(Path.ChangeExtension(InitializeEnvironment, "json")); - _dreamMan.OnException += OnException; - } + private void OnException(object? sender, Exception exception) => TestContext.WriteLine(exception); - private static string? Compile(string sourceFile) { - bool successfulCompile = DMCompiler.DMCompiler.Compile(new() { - Files = new() { sourceFile } - }); + [OneTimeSetUp] + public void OneTimeSetup() { + IoCManager.InjectDependencies(this); + _taskManager.Initialize(); + Compile(InitializeEnvironment); + _dreamMan.PreInitialize(Path.ChangeExtension(InitializeEnvironment, "json")); + _dreamMan.OnException += OnException; + } - return successfulCompile ? Path.ChangeExtension(sourceFile, "json") : null; - } + private static string? Compile(string sourceFile) { + bool successfulCompile = DMCompiler.DMCompiler.Compile(new() { + Files = new() { sourceFile } + }); - private static void Cleanup(string? compiledFile) { - if (!File.Exists(compiledFile)) - return; + return successfulCompile ? Path.ChangeExtension(sourceFile, "json") : null; + } - File.Delete(compiledFile); - } + private static void Cleanup(string? compiledFile) { + if (!File.Exists(compiledFile)) + return; - [Test, TestCaseSource(nameof(GetTests))] - public void TestFiles(string sourceFile, DMTestFlags testFlags) { - string initialDirectory = Directory.GetCurrentDirectory(); - TestContext.WriteLine($"--- TEST {sourceFile} | Flags: {testFlags}"); - try { - string? compiledFile = Compile(Path.Join(initialDirectory, TestsDirectory, sourceFile)); - if (testFlags.HasFlag(DMTestFlags.CompileError)) { - Assert.IsNull(compiledFile, "Expected an error during DM compilation"); - Cleanup(compiledFile); - TestContext.WriteLine($"--- PASS {sourceFile}"); - return; - } - - Assert.IsTrue(compiledFile is not null && File.Exists(compiledFile), "Failed to compile DM source file"); - Assert.IsTrue(_dreamMan.LoadJson(compiledFile), $"Failed to load {compiledFile}"); - _dreamMan.StartWorld(); - - (bool successfulRun, DreamValue? returned, Exception? exception) = RunTest(); - - if (testFlags.HasFlag(DMTestFlags.NoReturn)) { - Assert.IsFalse(returned.HasValue, "proc returned unexpectedly"); - } else { - Assert.IsTrue(returned.HasValue, "proc did not return (did it hit an exception?)"); - } - - if (testFlags.HasFlag(DMTestFlags.RuntimeError)) { - Assert.IsFalse(successfulRun, "A DM runtime exception was expected"); - } else { - if (exception != null) - Assert.IsTrue(successfulRun, $"A DM runtime exception was thrown: \"{exception}\""); - else - Assert.IsTrue(successfulRun, "A DM runtime exception was thrown, and its message could not be recovered!"); - } - - if (testFlags.HasFlag(DMTestFlags.ReturnTrue)) { - Assert.That(returned.HasValue, Is.True); - Assert.IsTrue(returned.Value.IsTruthy(), "Test was expected to return TRUE"); - } + File.Delete(compiledFile); + } + [Test, TestCaseSource(nameof(GetTests))] + public void TestFiles(string sourceFile, DMTestFlags testFlags) { + string initialDirectory = Directory.GetCurrentDirectory(); + TestContext.WriteLine($"--- TEST {sourceFile} | Flags: {testFlags}"); + try { + string? compiledFile = Compile(Path.Join(initialDirectory, TestsDirectory, sourceFile)); + if (testFlags.HasFlag(DMTestFlags.CompileError)) { + Assert.That(compiledFile, Is.Null, "Expected an error during DM compilation"); Cleanup(compiledFile); TestContext.WriteLine($"--- PASS {sourceFile}"); - } finally { - // Restore the original CurrentDirectory, since loading a compiled JSON changes it. - Directory.SetCurrentDirectory(initialDirectory); + return; } - } - private (bool Success, DreamValue? Returned, Exception? except) RunTest() { - var prev = _dreamMan.LastDMException; - - DreamValue? retValue = null; - Task callTask = null!; - - DreamThread.Run("RunTest", async (state) => { - if (_objectTree.TryGetGlobalProc("RunTest", out DreamProc? proc)) { - callTask = state.Call(proc, null, null); - retValue = await callTask; - return DreamValue.Null; - } else { - Assert.Fail("No global proc named RunTest"); - return DreamValue.Null; - } - }); - - var watch = new Stopwatch(); - watch.Start(); - - // Tick until our inner call has finished - while (!callTask.IsCompleted) { - _dreamMan.Update(); - _taskManager.ProcessPendingTasks(); - - if (watch.Elapsed.TotalMilliseconds > 500) { - Assert.Fail("Test timed out"); - } + Assert.That(compiledFile is not null && File.Exists(compiledFile), "Failed to compile DM source file"); + Assert.That(_dreamMan.LoadJson(compiledFile), $"Failed to load {compiledFile}"); + _dreamMan.StartWorld(); + + (bool successfulRun, DreamValue? returned, Exception? exception) = RunTest(); + + if (testFlags.HasFlag(DMTestFlags.NoReturn)) { + Assert.That(returned.HasValue, Is.False, "proc returned unexpectedly"); + } else { + Assert.That(returned.HasValue, "proc did not return (did it hit an exception?)"); } - bool retSuccess = _dreamMan.LastDMException == prev; // Works because "null == null" is true in this language. - return (retSuccess, retValue, _dreamMan.LastDMException); + if (testFlags.HasFlag(DMTestFlags.RuntimeError)) { + Assert.That(successfulRun, Is.False, "A DM runtime exception was expected"); + } else { + if (exception != null) + Assert.That(successfulRun, $"A DM runtime exception was thrown: \"{exception}\""); + else + Assert.That(successfulRun, "A DM runtime exception was thrown, and its message could not be recovered!"); + } + + if (testFlags.HasFlag(DMTestFlags.ReturnTrue)) { + Assert.That(returned?.IsTruthy(), Is.True, "Test was expected to return TRUE"); + } + + Cleanup(compiledFile); + TestContext.WriteLine($"--- PASS {sourceFile}"); + } finally { + // Restore the original CurrentDirectory, since loading a compiled JSON changes it. + Directory.SetCurrentDirectory(initialDirectory); } + } - private static IEnumerable GetTests() - { - Directory.SetCurrentDirectory(TestProject); + private (bool Success, DreamValue? Returned, Exception? except) RunTest() { + var prev = _dreamMan.LastDMException; - foreach (string sourceFile in Directory.GetFiles(TestsDirectory, "*.dm", SearchOption.AllDirectories)) { - string sourceFile2 = sourceFile[$"{TestsDirectory}/".Length..]; - DMTestFlags testFlags = GetDMTestFlags(sourceFile); - if (testFlags.HasFlag(DMTestFlags.Ignore)) - continue; + DreamValue? retValue = null; + Task callTask = null!; - yield return new object[] { - sourceFile2, - testFlags - }; + DreamThread.Run("RunTest", async (state) => { + if (_objectTree.TryGetGlobalProc("RunTest", out DreamProc? proc)) { + callTask = state.Call(proc, null, null); + retValue = await callTask; + return DreamValue.Null; + } else { + Assert.Fail("No global proc named RunTest"); + return DreamValue.Null; } - } + }); + + var watch = new Stopwatch(); + watch.Start(); + + // Tick until our inner call has finished + while (!callTask.IsCompleted) { + _dreamMan.Update(); + _taskManager.ProcessPendingTasks(); - private static DMTestFlags GetDMTestFlags(string sourceFile) { - DMTestFlags testFlags = DMTestFlags.NoError; - - using (StreamReader reader = new StreamReader(sourceFile)) { - string? firstLine = reader.ReadLine(); - if (firstLine == null) - return testFlags; - if (firstLine.Contains("IGNORE", StringComparison.InvariantCulture)) - testFlags |= DMTestFlags.Ignore; - if (firstLine.Contains("COMPILE ERROR", StringComparison.InvariantCulture)) - testFlags |= DMTestFlags.CompileError; - if (firstLine.Contains("RUNTIME ERROR", StringComparison.InvariantCulture)) - testFlags |= DMTestFlags.RuntimeError; - if (firstLine.Contains("RETURN TRUE", StringComparison.InvariantCulture)) - testFlags |= DMTestFlags.ReturnTrue; - if (firstLine.Contains("NO RETURN", StringComparison.InvariantCulture)) - testFlags |= DMTestFlags.NoReturn; + if (watch.Elapsed.TotalMilliseconds > 500) { + Assert.Fail("Test timed out"); } + } + + bool retSuccess = _dreamMan.LastDMException == prev; // Works because "null == null" is true in this language. + return (retSuccess, retValue, _dreamMan.LastDMException); + } + + private static IEnumerable GetTests() + { + Directory.SetCurrentDirectory(TestProject); - return testFlags; + foreach (string sourceFile in Directory.GetFiles(TestsDirectory, "*.dm", SearchOption.AllDirectories)) { + string sourceFile2 = sourceFile[$"{TestsDirectory}/".Length..]; + DMTestFlags testFlags = GetDMTestFlags(sourceFile); + if (testFlags.HasFlag(DMTestFlags.Ignore)) + continue; + + yield return new object[] { + sourceFile2, + testFlags + }; } + } - // TODO Convert the below async tests + private static DMTestFlags GetDMTestFlags(string sourceFile) { + DMTestFlags testFlags = DMTestFlags.NoError; + + using (StreamReader reader = new StreamReader(sourceFile)) { + string? firstLine = reader.ReadLine(); + if (firstLine == null) + return testFlags; + if (firstLine.Contains("IGNORE", StringComparison.InvariantCulture)) + testFlags |= DMTestFlags.Ignore; + if (firstLine.Contains("COMPILE ERROR", StringComparison.InvariantCulture)) + testFlags |= DMTestFlags.CompileError; + if (firstLine.Contains("RUNTIME ERROR", StringComparison.InvariantCulture)) + testFlags |= DMTestFlags.RuntimeError; + if (firstLine.Contains("RETURN TRUE", StringComparison.InvariantCulture)) + testFlags |= DMTestFlags.ReturnTrue; + if (firstLine.Contains("NO RETURN", StringComparison.InvariantCulture)) + testFlags |= DMTestFlags.NoReturn; + } - /*[Test, Timeout(10000)] - public void AsyncCall() { + return testFlags; + } - var result = DreamValue.Null; + // TODO Convert the below async tests - DreamThread.Run(async(state) => { - var world = _dreamMan.WorldInstance; - var proc = world.GetProc("async_test"); - result = await state.Call(proc, world, null, new DreamProcArguments(null)); - state.Runtime.Shutdown = true; - return DreamValue.Null; - }); + /*[Test, Timeout(10000)] + public void AsyncCall() { - runtime.Run(); + var result = DreamValue.Null; - Assert.AreEqual(new DreamValue(1337), result); - Assert.That(_dreamMan.DMExceptionCount, Is.EqualTo(prev)); - }*/ + DreamThread.Run(async(state) => { + var world = _dreamMan.WorldInstance; + var proc = world.GetProc("async_test"); + result = await state.Call(proc, world, null, new DreamProcArguments(null)); + state.Runtime.Shutdown = true; + return DreamValue.Null; + }); - /*[Test, Timeout(10000)] - public void WaitFor() { + runtime.Run(); - DreamValue result_1 = DreamValue.Null; - DreamValue result_2 = DreamValue.Null; + Assert.AreEqual(new DreamValue(1337), result); + Assert.That(_dreamMan.DMExceptionCount, Is.EqualTo(prev)); + }*/ - DreamThread.Run(async(state) => { - var world = _dreamMan.WorldInstance; - var proc_1 = world.GetProc("waitfor_1_a"); - result_1 = await state.Call(proc_1, world, null, new DreamProcArguments(null)); + /*[Test, Timeout(10000)] + public void WaitFor() { - var proc_2 = world.GetProc("waitfor_2_a"); - result_2 = await state.Call(proc_2, world, null, new DreamProcArguments(null)); + DreamValue result_1 = DreamValue.Null; + DreamValue result_2 = DreamValue.Null; - state.Runtime.Shutdown = true; - return DreamValue.Null; - }); + DreamThread.Run(async(state) => { + var world = _dreamMan.WorldInstance; + var proc_1 = world.GetProc("waitfor_1_a"); + result_1 = await state.Call(proc_1, world, null, new DreamProcArguments(null)); - runtime.Run(); + var proc_2 = world.GetProc("waitfor_2_a"); + result_2 = await state.Call(proc_2, world, null, new DreamProcArguments(null)); - Assert.AreEqual(new DreamValue(3), result_1); - Assert.AreEqual(new DreamValue(2), result_2); - Assert.That(_dreamMan.DMExceptionCount, Is.EqualTo(prev)); - }*/ - } + state.Runtime.Shutdown = true; + return DreamValue.Null; + }); + + runtime.Run(); + + Assert.AreEqual(new DreamValue(3), result_1); + Assert.AreEqual(new DreamValue(2), result_2); + Assert.That(_dreamMan.DMExceptionCount, Is.EqualTo(prev)); + }*/ } diff --git a/DMCompiler/DMCompiler.csproj b/DMCompiler/DMCompiler.csproj index 53b82d0b6c..82cddd4ad9 100644 --- a/DMCompiler/DMCompiler.csproj +++ b/DMCompiler/DMCompiler.csproj @@ -1,5 +1,4 @@  - Exe net8.0 @@ -24,6 +23,4 @@ - - diff --git a/DMDisassembler/DMDisassembler.csproj b/DMDisassembler/DMDisassembler.csproj index e116fcf4e6..6355f4bb4f 100644 --- a/DMDisassembler/DMDisassembler.csproj +++ b/DMDisassembler/DMDisassembler.csproj @@ -1,5 +1,4 @@  - Exe net8.0 @@ -11,5 +10,4 @@ - diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000000..9e2d5a099a --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/OpenDream.sln b/OpenDream.sln index 7c81824472..35847e91f3 100644 --- a/OpenDream.sln +++ b/OpenDream.sln @@ -56,8 +56,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenToolkit.GraphicsLibrary EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.LoaderApi", "RobustToolbox\Robust.LoaderApi\Robust.LoaderApi\Robust.LoaderApi.csproj", "{7AA19C30-0627-473E-B3D0-08E96FC2D77D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Robust.Physics", "RobustToolbox\Robust.Physics\Robust.Physics.csproj", "{B9712645-6DAD-4D51-BF56-8FE1422EDB3E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XamlX", "XamlX", "{2E99CFE9-C7C6-4275-8730-2672E28CCEA4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XamlX", "RobustToolbox\XamlX\src\XamlX\XamlX.csproj", "{ECB7A503-FF99-4E73-927A-B434915A452A}" @@ -280,16 +278,6 @@ Global {7AA19C30-0627-473E-B3D0-08E96FC2D77D}.Release|x64.Build.0 = Release|Any CPU {7AA19C30-0627-473E-B3D0-08E96FC2D77D}.Tools|Any CPU.ActiveCfg = Tools|Any CPU {7AA19C30-0627-473E-B3D0-08E96FC2D77D}.Tools|Any CPU.Build.0 = Tools|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Debug|x64.ActiveCfg = Debug|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Debug|x64.Build.0 = Debug|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Release|Any CPU.Build.0 = Release|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Release|x64.ActiveCfg = Release|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Release|x64.Build.0 = Release|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Tools|Any CPU.ActiveCfg = Tools|Any CPU - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E}.Tools|Any CPU.Build.0 = Tools|Any CPU {ECB7A503-FF99-4E73-927A-B434915A452A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ECB7A503-FF99-4E73-927A-B434915A452A}.Debug|Any CPU.Build.0 = Debug|Any CPU {ECB7A503-FF99-4E73-927A-B434915A452A}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -461,7 +449,6 @@ Global {4A4148E4-C82C-45F5-8278-371CA0567EFB} = {DBFD7471-84E2-4AAB-86E9-F8DFF917ED5B} {D5D921FD-A535-40CE-AED2-0526AC4015E4} = {DBFD7471-84E2-4AAB-86E9-F8DFF917ED5B} {7AA19C30-0627-473E-B3D0-08E96FC2D77D} = {DBFD7471-84E2-4AAB-86E9-F8DFF917ED5B} - {B9712645-6DAD-4D51-BF56-8FE1422EDB3E} = {DBFD7471-84E2-4AAB-86E9-F8DFF917ED5B} {2E99CFE9-C7C6-4275-8730-2672E28CCEA4} = {DBFD7471-84E2-4AAB-86E9-F8DFF917ED5B} {ECB7A503-FF99-4E73-927A-B434915A452A} = {2E99CFE9-C7C6-4275-8730-2672E28CCEA4} {C598983A-4FE6-45FF-A6C2-1563394285E1} = {2E99CFE9-C7C6-4275-8730-2672E28CCEA4} diff --git a/OpenDreamClient/OpenDreamClient.csproj b/OpenDreamClient/OpenDreamClient.csproj index e06241556c..2ba9bcc9e4 100644 --- a/OpenDreamClient/OpenDreamClient.csproj +++ b/OpenDreamClient/OpenDreamClient.csproj @@ -9,9 +9,6 @@ Exe enable - - - diff --git a/OpenDreamPackageTool/OpenDreamPackageTool.csproj b/OpenDreamPackageTool/OpenDreamPackageTool.csproj index ac86916b7a..42742821dd 100644 --- a/OpenDreamPackageTool/OpenDreamPackageTool.csproj +++ b/OpenDreamPackageTool/OpenDreamPackageTool.csproj @@ -1,5 +1,4 @@ - Exe net8.0 @@ -10,5 +9,4 @@ - diff --git a/OpenDreamPackaging/OpenDreamPackaging.csproj b/OpenDreamPackaging/OpenDreamPackaging.csproj index 34748e8ac1..468cf35904 100644 --- a/OpenDreamPackaging/OpenDreamPackaging.csproj +++ b/OpenDreamPackaging/OpenDreamPackaging.csproj @@ -1,5 +1,4 @@ - Exe net8.0 @@ -10,5 +9,4 @@ - diff --git a/OpenDreamRuntime/Objects/DreamIcon.cs b/OpenDreamRuntime/Objects/DreamIcon.cs index 4d8320433c..e491281f42 100644 --- a/OpenDreamRuntime/Objects/DreamIcon.cs +++ b/OpenDreamRuntime/Objects/DreamIcon.cs @@ -5,7 +5,7 @@ using OpenDreamShared.Dream; using OpenDreamShared.Resources; using SixLabors.ImageSharp; -using SixLabors.ImageSharp.Formats.Png; +using SixLabors.ImageSharp.Formats.Png.Chunks; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using Color = Robust.Shared.Maths.Color; @@ -116,22 +116,21 @@ public IconResource GenerateDMI() { } } - Image dmiImage = Image.LoadPixelData(pixels, span, frameHeight); + Image dmiImage = Image.LoadPixelData(pixels, span, frameHeight); ParsedDMIDescription newDescription = new() {Width = frameWidth, Height = frameHeight, States = dmiStates}; PixelArrayPool.Return(pixels, clearArray: true); - using (MemoryStream dmiImageStream = new MemoryStream()) { - var pngTextData = new PngTextData("Description", newDescription.ExportAsText(), null, null); - var pngMetadata = dmiImage.Metadata.GetPngMetadata(); - pngMetadata.TextData.Add(pngTextData); + using var dmiImageStream = new MemoryStream(); + var pngTextData = new PngTextData("Description", newDescription.ExportAsText(), null, null); + var pngMetadata = dmiImage.Metadata.GetPngMetadata(); + pngMetadata.TextData.Add(pngTextData); - dmiImage.SaveAsPng(dmiImageStream); + dmiImage.SaveAsPng(dmiImageStream); - IconResource newResource = _resourceManager.CreateIconResource(dmiImageStream.GetBuffer(), dmiImage, newDescription); - _cachedDMI = newResource; - return _cachedDMI; - } + IconResource newResource = _resourceManager.CreateIconResource(dmiImageStream.GetBuffer(), dmiImage, newDescription); + _cachedDMI = newResource; + return _cachedDMI; } public void ApplyOperation(IDreamIconOperation operation) { diff --git a/OpenDreamRuntime/OpenDreamRuntime.csproj b/OpenDreamRuntime/OpenDreamRuntime.csproj index 6c861cf1b5..e6858df7e9 100644 --- a/OpenDreamRuntime/OpenDreamRuntime.csproj +++ b/OpenDreamRuntime/OpenDreamRuntime.csproj @@ -13,7 +13,7 @@ - + diff --git a/OpenDreamShared/OpenDreamShared.csproj b/OpenDreamShared/OpenDreamShared.csproj index 59d0a5476e..cfcc9c450a 100644 --- a/OpenDreamShared/OpenDreamShared.csproj +++ b/OpenDreamShared/OpenDreamShared.csproj @@ -10,7 +10,7 @@ enable - + diff --git a/RobustToolbox b/RobustToolbox index 73357f022b..e357dada65 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 73357f022ba3a0b60587b602f68e160df6d79648 +Subproject commit e357dada656776118c7cd05a8effaaaca74e8f9c