diff --git a/Awperative/Kernel/Communication/Debug/Core.cs b/Awperative/Kernel/Communication/Debug/Core.cs index 3b6048c..4f8f51e 100644 --- a/Awperative/Kernel/Communication/Debug/Core.cs +++ b/Awperative/Kernel/Communication/Debug/Core.cs @@ -8,7 +8,7 @@ using Awperative.Kernel.Communication.Config; namespace Awperative; -public static partial class Debugger +public static partial class Debug { diff --git a/Awperative/Kernel/Communication/Debug/Writer.cs b/Awperative/Kernel/Communication/Debug/Writer.cs index eb3a788..73b2d9f 100644 --- a/Awperative/Kernel/Communication/Debug/Writer.cs +++ b/Awperative/Kernel/Communication/Debug/Writer.cs @@ -5,13 +5,63 @@ using System.IO; namespace Awperative; -public static partial class Debugger +public static partial class Debug { /// /// Writes the current message to the log file. /// /// Message to debug - public static void DebugState(string __message) => DebugGeneric(__message, "STA"); + public static void LogState(string __message) => LogGeneric(__message, "STA", [], []); + + + + /// + /// Writes the current message to the log file. With any given call sign. + /// + /// Message to debug + /// Names of values to debug + /// Values to debug + public static void LogState(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "STA", __parameters, __values); + + + + + + /// + /// Writes the current message to the log file. + /// + /// Message to debug + public static void LogValue(string __message) => LogGeneric(__message, "VAL", [], []); + + + + /// + /// Writes the current message to the log file. With any given call sign. + /// + /// Message to debug + /// Names of values to debug + /// Values to debug + public static void LogValue(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "VAL", __parameters, __values); + + + + + + /// + /// Writes the current message to the log file. + /// + /// Message to debug + public static void LogWarning(string __message) => LogGeneric(__message, "WAR", [], []); + + + + /// + /// Writes the current message to the log file. With any given call sign. + /// + /// Message to debug + /// Names of values to debug + /// Values to debug + public static void LogWarning(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "WAR", __parameters, __values); @@ -21,37 +71,17 @@ public static partial class Debugger /// Writes the current message to the log file. /// /// Message to debug - public static void DebugValue(string __message) => DebugGeneric(__message, "VAL"); - - + public static void LogError(string __message) => LogGeneric(__message, "ERR", [], []); /// - /// Writes the current message to the log file. + /// Writes the current message to the log file. With any given call sign. /// /// Message to debug - public static void DebugLog(string __message) => DebugGeneric(__message, "LOG"); - - - - - - /// - /// Writes the current message to the log file. - /// - /// Message to debug - public static void DebugWarning(string __message) => DebugGeneric(__message, "WAR"); - - - - - - /// - /// Writes the current message to the log file. - /// - /// Message to debug - public static void DebugError(string __message) => DebugGeneric(__message, "ERR"); + /// Names of values to debug + /// Values to debug + public static void LogError(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "ERR", __parameters, __values); @@ -62,7 +92,14 @@ public static partial class Debugger /// /// Message to debug /// Message identifier - public static void DebugGeneric(string __message, string __callSign) { - File.AppendAllText(LogFilePath, "\n\n" + __callSign + "- \"" + __message + "\"\n STK-" + new StackTrace()); + /// Names of values to debug + /// Values to debug + public static void LogGeneric(string __message, string __callSign, string[] __parameters, string[] __values) { + string output = "\n\n" + __callSign + "- \"" + __message + "\"\n STK-" + new StackTrace(); + + for (int i = 0; i < __parameters.Length || i < __values.Length; i++) + output += "\n " + __parameters[i] + "- " + __values[i]; + + File.AppendAllText(LogFilePath, output); } } \ No newline at end of file diff --git a/Awperative/Kernel/Entities/Bodies/Components.cs b/Awperative/Kernel/Entities/Bodies/Components.cs index 654003d..7bbf967 100644 --- a/Awperative/Kernel/Entities/Bodies/Components.cs +++ b/Awperative/Kernel/Entities/Bodies/Components.cs @@ -8,19 +8,16 @@ public sealed partial class Body { public Generic AddComponent(object[] args) where Generic : Component { + if (SingletonExists()) { Debug.LogError("Cannot add component when singleton exists!"); return null; } - if (SingletonExists()) - throw new Exception("Cannot add component when singleton exists!"); - Generic component = (Generic) Activator.CreateInstance(typeof(Generic), args); - - if(component == null) - throw new Exception("Failed to create component!"); - - components.Add(component); + + if (component == null) { Debug.LogError("Failed to create component!"); return null; } + + _components.Add(component); component.Initiate(this); - ComponentCreatedEvent?.Invoke(this, new ComponentCreateEvent(component, this, scene)); + ComponentCreatedEvent?.Invoke(this, new ComponentCreateEvent(component, this, Scene)); return component; } diff --git a/Awperative/Kernel/Entities/Scenes/Core.cs b/Awperative/Kernel/Entities/Scenes/Core.cs index 6bd8a51..0559e78 100644 --- a/Awperative/Kernel/Entities/Scenes/Core.cs +++ b/Awperative/Kernel/Entities/Scenes/Core.cs @@ -5,6 +5,6 @@ namespace Awperative; public sealed partial class Scene { - + //todo: add scene.destroy in v5 -} \ No newline at end of file +} diff --git a/Awperative/obj/Awperative.csproj.nuget.dgspec.json b/Awperative/obj/Awperative.csproj.nuget.dgspec.json index dbb49e0..58ccd1e 100644 --- a/Awperative/obj/Awperative.csproj.nuget.dgspec.json +++ b/Awperative/obj/Awperative.csproj.nuget.dgspec.json @@ -60,7 +60,7 @@ "privateAssets": "all" } }, - "runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.122/PortableRuntimeIdentifierGraph.json" + "runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.123/PortableRuntimeIdentifierGraph.json" } } } diff --git a/Awperative/obj/Debug/net8.0/Awperative.AssemblyInfo.cs b/Awperative/obj/Debug/net8.0/Awperative.AssemblyInfo.cs index 7407b74..4baf412 100644 --- a/Awperative/obj/Debug/net8.0/Awperative.AssemblyInfo.cs +++ b/Awperative/obj/Debug/net8.0/Awperative.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Awperative")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6370a70e77e58afd49c5270eea3656796c8a8b60")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6032a04ad97895ae66261315ee00dc458991fddb")] [assembly: System.Reflection.AssemblyProductAttribute("Awperative")] [assembly: System.Reflection.AssemblyTitleAttribute("Awperative")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Awperative/obj/Debug/net8.0/Awperative.AssemblyInfoInputs.cache b/Awperative/obj/Debug/net8.0/Awperative.AssemblyInfoInputs.cache index f77fe93..16aad8b 100644 --- a/Awperative/obj/Debug/net8.0/Awperative.AssemblyInfoInputs.cache +++ b/Awperative/obj/Debug/net8.0/Awperative.AssemblyInfoInputs.cache @@ -1 +1 @@ -65f076e2a35d39f7816008dc38aa7c8c9fe617c292f8f16923e08f8a886186cf +b425b3bf0701917a4ebea9a237727c5966a9c5c39530e5ed5a453056bfdf1602 diff --git a/Awperative/obj/project.assets.json b/Awperative/obj/project.assets.json index 90670c4..721c7fe 100644 --- a/Awperative/obj/project.assets.json +++ b/Awperative/obj/project.assets.json @@ -331,7 +331,7 @@ "privateAssets": "all" } }, - "runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.122/PortableRuntimeIdentifierGraph.json" + "runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/8.0.123/PortableRuntimeIdentifierGraph.json" } } } diff --git a/Awperative/obj/project.nuget.cache b/Awperative/obj/project.nuget.cache index fc16639..a01abdc 100644 --- a/Awperative/obj/project.nuget.cache +++ b/Awperative/obj/project.nuget.cache @@ -1,6 +1,6 @@ { "version": 2, - "dgSpecHash": "R13j3OnnaSw=", + "dgSpecHash": "oHHZKOBBLTE=", "success": true, "projectFilePath": "/home/avery/Programming/Awperative/Awperative/Awperative.csproj", "expectedPackageFiles": [ diff --git a/Awperative/obj/project.packagespec.json b/Awperative/obj/project.packagespec.json index 10bde13..f45ed5a 100644 --- a/Awperative/obj/project.packagespec.json +++ b/Awperative/obj/project.packagespec.json @@ -1 +1 @@ -"restore":{"projectUniqueName":"/home/avery/Programming/Awperative/Awperative/Awperative.csproj","projectName":"Awperative","projectPath":"/home/avery/Programming/Awperative/Awperative/Awperative.csproj","outputPath":"/home/avery/Programming/Awperative/Awperative/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"MonoGame.Framework.DesktopGL":{"suppressParent":"All","target":"Package","version":"[3.8.*, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/lib/dotnet/sdk/8.0.122/PortableRuntimeIdentifierGraph.json"}} \ No newline at end of file +"restore":{"projectUniqueName":"/home/avery/Programming/Awperative/Awperative/Awperative.csproj","projectName":"Awperative","projectPath":"/home/avery/Programming/Awperative/Awperative/Awperative.csproj","outputPath":"/home/avery/Programming/Awperative/Awperative/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net8.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"MonoGame.Framework.DesktopGL":{"suppressParent":"All","target":"Package","version":"[3.8.*, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/usr/lib/dotnet/sdk/8.0.123/PortableRuntimeIdentifierGraph.json"}} \ No newline at end of file diff --git a/Awperative/obj/rider.project.restore.info b/Awperative/obj/rider.project.restore.info index b82b0ef..b3bcf68 100644 --- a/Awperative/obj/rider.project.restore.info +++ b/Awperative/obj/rider.project.restore.info @@ -1 +1 @@ -17688491570718218 \ No newline at end of file +17701648299693068 \ No newline at end of file