From 227e70219acaaa9bbd4981af01eb79aaf1d96e0e Mon Sep 17 00:00:00 2001 From: Avery Norris Date: Mon, 2 Mar 2026 14:18:59 -0500 Subject: [PATCH] a --- .../Kernel/Atrributes/DebugAttributes.cs | 52 ++-- .../ComponentDockerMovement.cs | 24 +- .../ComponentDockerMutation.cs | 130 +++++----- AwperativeKernel/Kernel/Debug/Debug.cs | 236 ------------------ AwperativeKernel/Kernel/Debug/Debug.md | 5 - AwperativeKernel/Kernel/Inspector/Show.cs | 11 - .../Kernel/Overhead/Awperative/Awperative.cs | 59 ++--- .../AwperativeKernel.csproj.nuget.dgspec.json | 22 +- .../obj/AwperativeKernel.csproj.nuget.g.props | 8 +- .../net8.0/AwperativeKernel.AssemblyInfo.cs | 2 +- .../AwperativeKernel.AssemblyInfoInputs.cache | 2 +- ....GeneratedMSBuildEditorConfig.editorconfig | 4 +- .../net8.0/AwperativeKernel.assets.cache | Bin 8294 -> 8640 bytes ...ativeKernel.csproj.AssemblyReference.cache | Bin 4263 -> 4333 bytes AwperativeKernel/obj/project.assets.json | 20 +- AwperativeKernel/obj/project.nuget.cache | 34 +-- AwperativeKernel/obj/project.packagespec.json | 2 +- .../obj/rider.project.model.nuget.info | 2 +- .../obj/rider.project.restore.info | 2 +- 19 files changed, 173 insertions(+), 442 deletions(-) delete mode 100644 AwperativeKernel/Kernel/Debug/Debug.cs delete mode 100644 AwperativeKernel/Kernel/Debug/Debug.md delete mode 100644 AwperativeKernel/Kernel/Inspector/Show.cs diff --git a/AwperativeKernel/Kernel/Atrributes/DebugAttributes.cs b/AwperativeKernel/Kernel/Atrributes/DebugAttributes.cs index fbdaeb6..9329fb9 100644 --- a/AwperativeKernel/Kernel/Atrributes/DebugAttributes.cs +++ b/AwperativeKernel/Kernel/Atrributes/DebugAttributes.cs @@ -33,7 +33,7 @@ public static class DebugAttributes public static bool VerifyOrThrow(ComponentDocker __docker, Component __component) { if (__docker.Contains(__component)) return true; - Debug.LogError("Docker does not own the Component!", + Awperative.Debug.LogError("Docker does not own the Component!", ["ComponentType", "ComponentName", "ComponentHash", "DockerType", "DockerName", "DockerHash"], [ __component.GetType().Name, __component.Name, @@ -43,7 +43,7 @@ public static class DebugAttributes __docker.GetHashCode().ToString("N0") ]); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -60,7 +60,7 @@ public static class DebugAttributes public static bool VerifyOrThrow(ComponentDocker __docker, Component __component) { if (!__docker.Contains(__component)) return true; - Debug.LogError("Docker owns the Component!", + Awperative.Debug.LogError("Docker owns the Component!", ["ComponentType", "ComponentName", "ComponentHash", "DockerType", "DockerName", "DockerHash"], [ __component.GetType().Name, __component.Name, @@ -70,7 +70,7 @@ public static class DebugAttributes __docker.GetHashCode().ToString("N0") ]); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -87,7 +87,7 @@ public static class DebugAttributes public static bool VerifyOrThrow(Component __component) { if (__component.ComponentDocker == null) return true; - Debug.LogError("Component is already owned!", + Awperative.Debug.LogError("Component is already owned!", ["ComponentType", "ComponentName", "ComponentHash", "DockerType", "DockerName", "DockerHash"], [ __component.GetType().Name, __component.Name, @@ -97,7 +97,7 @@ public static class DebugAttributes __component.ComponentDocker.GetHashCode().ToString("N0") ]); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -114,13 +114,13 @@ public static class DebugAttributes public static bool VerifyOrThrow(ComponentDocker __docker, ComponentDocker __other) { if (!__docker.Equals(__other)) return true; - Debug.LogError("The dockers are the same!", ["DockerType", "DockerName", "DockerHash"], [ + Awperative.Debug.LogError("The dockers are the same!", ["DockerType", "DockerName", "DockerHash"], [ __docker.GetType().Name, __docker switch { Scene scene => scene.Name, Component component => component.Name, _ => "unknown" }, __docker.GetHashCode().ToString("N0") ]); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -137,9 +137,9 @@ public static class DebugAttributes public static bool VerifyOrThrow(Component __component) { if (__component != null) return true; - Debug.LogError("Component is null!"); + Awperative.Debug.LogError("Component is null!"); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -156,9 +156,9 @@ public static class DebugAttributes public static bool VerifyOrThrow(ComponentDocker __componentDocker) { if (__componentDocker != null) return true; - Debug.LogError("Docker is null!"); + Awperative.Debug.LogError("Docker is null!"); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -175,9 +175,9 @@ public static class DebugAttributes public static bool VerifyOrThrow(Scene __scene) { if (__scene != null) return true; - Debug.LogError("Scene is null!"); + Awperative.Debug.LogError("Scene is null!"); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -195,8 +195,8 @@ public static class DebugAttributes public static bool VerifyOrThrow(ICollection __collection) { foreach (object obj in __collection) { if (obj == null) { - Debug.LogError("A given enumerator has null members!", ["Type"], [__collection.GetType().Name]); - return Debug.IgnoreErrors; + Awperative.Debug.LogError("A given enumerator has null members!", ["Type"], [__collection.GetType().Name]); + return Awperative.Debug.IgnoreErrors; } } @@ -216,8 +216,8 @@ public static class DebugAttributes public static bool VerifyOrThrow(IEnumerable __enumerator) { foreach (object obj in __enumerator) { if (obj == null) { - Debug.LogError("A given enumerator has null members!", ["Type"], [__enumerator.GetType().Name]); - return Debug.IgnoreErrors; + Awperative.Debug.LogError("A given enumerator has null members!", ["Type"], [__enumerator.GetType().Name]); + return Awperative.Debug.IgnoreErrors; } } @@ -237,9 +237,9 @@ public static class DebugAttributes public static bool VerifyOrThrow(Object __object) { if (__object != null) return true; - Debug.LogError("A given object is null!"); + Awperative.Debug.LogError("A given object is null!"); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -255,9 +255,9 @@ public static class DebugAttributes public static bool VerifyOrThrow(int __index, int __min, int __max) { if (__index >= __min && __index <= __max) return true; - Debug.LogError("Value does not fit range!", ["Index"], [__index.ToString("N0")]); + Awperative.Debug.LogError("Value does not fit range!", ["Index"], [__index.ToString("N0")]); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -273,9 +273,9 @@ public static class DebugAttributes public static bool VerifyOrThrow<__Type>(__Type __object, ICollection<__Type> __collection) { if (__collection.Contains(__object)) return true; - Debug.LogError("Collection does not contain object!", ["ObjectType"], [__object.GetType().Name]); + Awperative.Debug.LogError("Collection does not contain object!", ["ObjectType"], [__object.GetType().Name]); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } @@ -291,9 +291,9 @@ public static class DebugAttributes public static bool VerifyOrThrow<__Type>(__Type __object, ICollection<__Type> __collection) { if (!__collection.Contains(__object)) return true; - Debug.LogError("Collection already contains object!", ["ObjectType"], [__object.GetType().Name]); + Awperative.Debug.LogError("Collection already contains object!", ["ObjectType"], [__object.GetType().Name]); - return Debug.IgnoreErrors; + return Awperative.Debug.IgnoreErrors; } } diff --git a/AwperativeKernel/Kernel/ComponentDocker/ComponentDockerMovement.cs b/AwperativeKernel/Kernel/ComponentDocker/ComponentDockerMovement.cs index f94c3e1..1a50caf 100644 --- a/AwperativeKernel/Kernel/ComponentDocker/ComponentDockerMovement.cs +++ b/AwperativeKernel/Kernel/ComponentDocker/ComponentDockerMovement.cs @@ -17,14 +17,6 @@ public abstract partial class ComponentDocker if(!DebugAttributes.DockerNotNull.VerifyOrThrow(__componentDocker)) return; if(!DebugAttributes.DifferentDocker.VerifyOrThrow(this, __componentDocker)) return; - if (!Contains(__component)) { - Debug.LogError("Docker does not have ownership over Component!", ["ComponentType"], [__component.GetType().Name]); return; - } - - if (__componentDocker == this) { - Debug.LogError("Docker already has Component!", ["ComponentType"], [__component.GetType().Name]); return; - } - RemoveComponentFromLists(__component); __componentDocker.AddComponentToLists(__component); @@ -46,51 +38,51 @@ public abstract partial class ComponentDocker /// Moves the first component with a given Type [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] - public void Move<__Type>(ComponentDocker __componentDocker) where __Type : Component => Move(Get<__Type>(), __componentDocker); + public void Move<__Type>([DebugAttributes.DockerNotNull, DebugAttributes.DifferentDocker] ComponentDocker __componentDocker) where __Type : Component => Move(Get<__Type>(), __componentDocker); /// Moves all components of a given type [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Low), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void MoveAll<__Type>(ComponentDocker __componentDocker) where __Type : Component => MoveAll(GetAll<__Type>(), __componentDocker); + public void MoveAll<__Type>([DebugAttributes.DockerNotNull, DebugAttributes.DifferentDocker] ComponentDocker __componentDocker) where __Type : Component => MoveAll(GetAll<__Type>(), __componentDocker); /// Moves all components that have all the given tags [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void MoveAll(IEnumerable __tags, ComponentDocker __componentDocker) => MoveAll(GetAll(__tags), __componentDocker); + public void MoveAll([DebugAttributes.EnumeratorNotNull] IEnumerable __tags, [DebugAttributes.DockerNotNull, DebugAttributes.DifferentDocker] ComponentDocker __componentDocker) => MoveAll(GetAll(__tags), __componentDocker); /// Moves all Components that have the given type, and all the given tags [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void MoveAll<__Type>(IEnumerable __tags, ComponentDocker __componentDocker) where __Type : Component => MoveAll(GetAll<__Type>(__tags), __componentDocker); + public void MoveAll<__Type>([DebugAttributes.EnumeratorNotNull] IEnumerable __tags, [DebugAttributes.DockerNotNull, DebugAttributes.DifferentDocker] ComponentDocker __componentDocker) where __Type : Component => MoveAll(GetAll<__Type>(__tags), __componentDocker); /// Moves all the components with the given tag [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] - public void MoveAll(string __tag, ComponentDocker __componentDocker) => MoveAll(GetAll([__tag]), __componentDocker); + public void MoveAll([DebugAttributes.NotNull] string __tag, [DebugAttributes.DockerNotNull, DebugAttributes.DifferentDocker] ComponentDocker __componentDocker) => MoveAll(GetAll([__tag]), __componentDocker); /// Moves all the components that have a certain type, and a certain tag [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void MoveAll<__Type>(string __tag, ComponentDocker __componentDocker) where __Type : Component => MoveAll(GetAll<__Type>([__tag]), __componentDocker); + public void MoveAll<__Type>([DebugAttributes.NotNull] string __tag, [DebugAttributes.DockerNotNull, DebugAttributes.DifferentDocker] ComponentDocker __componentDocker) where __Type : Component => MoveAll(GetAll<__Type>([__tag]), __componentDocker); /// Moves the first component with the given tag [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] - public void Move(string __tag, ComponentDocker __componentDocker) => Move(GetAll([__tag]).FirstOrDefault(), __componentDocker); + public void Move([DebugAttributes.NotNull] string __tag, [DebugAttributes.DockerNotNull, DebugAttributes.DifferentDocker] ComponentDocker __componentDocker) => Move(GetAll([__tag]).FirstOrDefault(), __componentDocker); /// Moves the moves component with the given type and tag [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void Move<__Type>(string __tag, ComponentDocker __componentDocker) where __Type : Component => Move(GetAll<__Type>(__tag).FirstOrDefault(), __componentDocker); + public void Move<__Type>([DebugAttributes.NotNull] string __tag, [DebugAttributes.DockerNotNull, DebugAttributes.DifferentDocker] ComponentDocker __componentDocker) where __Type : Component => Move(GetAll<__Type>(__tag).FirstOrDefault(), __componentDocker); } \ No newline at end of file diff --git a/AwperativeKernel/Kernel/ComponentDocker/ComponentDockerMutation.cs b/AwperativeKernel/Kernel/ComponentDocker/ComponentDockerMutation.cs index 2524b8e..194bbb3 100644 --- a/AwperativeKernel/Kernel/ComponentDocker/ComponentDockerMutation.cs +++ b/AwperativeKernel/Kernel/ComponentDocker/ComponentDockerMutation.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -11,118 +10,123 @@ namespace AwperativeKernel; public abstract partial class ComponentDocker { - - + + /// Attaches a preexisting component to the docker, this is not transferring the component, the method will throw an error if the component is already attached to a docker [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] - public void Add([DebugAttributes.ComponentNotNull,DebugAttributes.OrphanComponent] Component __component) { - if(!DebugAttributes.ComponentNotNull.VerifyOrThrow(__component)) return; - if(!DebugAttributes.OrphanComponent.VerifyOrThrow(__component)) return; - - //Component has already been added to another docker - if (__component.ComponentDocker != null) { Debug.LogError("You cannot use add if the Component already belongs to a Docker, use Component.Transfer();"); return; } - + public void Add([DebugAttributes.ComponentNotNull, DebugAttributes.OrphanComponent] Component __component) { + if (!DebugAttributes.ComponentNotNull.VerifyOrThrow(__component)) return; + if (!DebugAttributes.OrphanComponent.VerifyOrThrow(__component)) return; + InitiateComponent(__component); } - - - /// Creates a new instance of that type of component and attaches it to the docker, and returns a reference to it. - public __Type Add<__Type>() where __Type : Component, new() { Component newComponent = new __Type(); InitiateComponent(newComponent); return (__Type)newComponent; } - + /// Creates a new instance of that type of component and attaches it to the docker, and returns a reference to it. + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Low), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] + public __Type Add<__Type>() where __Type : Component, new() { + Component newComponent = new __Type(); + InitiateComponent(newComponent); + return (__Type)newComponent; + } + + + /// Creates a new instance of that type of component and attaches it to the docker, and returns a reference to it. [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] public __Type Add<__Type>(string name = null, [DebugAttributes.ValueFitsRange] int priority = 0, Collection tags = null) where __Type : Component, new() { - Component newComponent = new __Type(); + Component newComponent = new __Type(); newComponent.Name = name ??= typeof(__Type).Name; newComponent._tags = [..tags ??= []]; newComponent.Priority = priority; - - InitiateComponent(newComponent); return (__Type)newComponent; + + InitiateComponent(newComponent); + return (__Type)newComponent; } - - + + /// Initiates a component into the docker. [MarkerAttributes.UnsafeInternal] private void InitiateComponent(Component __component) { //add to Component Docker's lists AddComponentToLists(__component); - + __component.ComponentDocker = this; //create event - __component.TryEvent(4); __component.ChainEvent(4); + __component.TryEvent(4); + __component.ChainEvent(4); } - - + + /// Destroys a component attached to the Docker /// - public void Destroy([DebugAttributes.ComponentNotNull,DebugAttributes.DockerOwns] Component __component) { - Stopwatch timer = Stopwatch.StartNew(); - if(!DebugAttributes.ComponentNotNull.VerifyOrThrow(__component)) return; - if(!DebugAttributes.DockerOwns.VerifyOrThrow(this, __component)) return; + public void Destroy([DebugAttributes.ComponentNotNull, DebugAttributes.DockerOwns] Component __component) { + if (!DebugAttributes.ComponentNotNull.VerifyOrThrow(__component)) return; + if (!DebugAttributes.DockerOwns.VerifyOrThrow(this, __component)) return; __component.TryEvent(5); - __component.ChainEvent(5); - + __component.ChainEvent(5); + RemoveComponentFromLists(__component); __component.ComponentDocker = null; } - - - + + + /// Destroys all the components in a given list - public void DestroyAll([DebugAttributes.ComponentNotNull, DebugAttributes.DockerOwns] IEnumerable __Components) { foreach(Component component in __Components) Destroy(component); } - - - + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] + public void DestroyAll([DebugAttributes.EnumeratorNotNull, DebugAttributes.DockerOwns] IEnumerable __Components) { foreach (Component component in __Components) Destroy(component); } + + + /// Destroys the first component with a given Type - [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Low), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] public void Destroy<__Type>() where __Type : Component => Destroy(Get<__Type>()); /// Destroys all components of a given type - [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Low), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] public void DestroyAll<__Type>() where __Type : Component => DestroyAll(GetAll<__Type>()); /// Destroys all components that have all the given tags - [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void DestroyAll(IEnumerable __tags) => DestroyAll(GetAll(__tags)); + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] + public void DestroyAll([DebugAttributes.EnumeratorNotNull] IEnumerable __tags) => DestroyAll(GetAll(__tags)); + - /// Destroys all Components that have the given type, and all the given tags - [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void DestroyAll<__Type>(IEnumerable __tags) where __Type : Component => DestroyAll(GetAll<__Type>(__tags)); - - - - + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] + public void DestroyAll<__Type>([DebugAttributes.EnumeratorNotNull] IEnumerable __tags) where __Type : Component => DestroyAll(GetAll<__Type>(__tags)); + + + + /// Destroys all the components with the given tag - [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] - public void DestroyAll(string __tag) => DestroyAll(GetAll([__tag])); - - - + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] + public void DestroyAll([DebugAttributes.NotNull] string __tag) => DestroyAll(GetAll([__tag])); + + + /// Destroys all the components that have a certain type, and a certain tag - [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void DestroyAll<__Type>(string __tag) where __Type : Component => DestroyAll(GetAll<__Type>([__tag])); - - + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] + public void DestroyAll<__Type>([DebugAttributes.NotNull] string __tag) where __Type : Component => DestroyAll(GetAll<__Type>([__tag])); + + /// Destroys the first component with the given tag - [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] - public void Destroy(string __tag) => Destroy(GetAll([__tag]).FirstOrDefault()); + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Low), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] + public void Destroy([DebugAttributes.NotNull] string __tag) => Destroy(GetAll([__tag]).FirstOrDefault()); + - /// Destroys the Destroys component with the given type and tag - [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.VeryLow), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] - public void Destroy<__Type>(string __tag) where __Type : Component => Destroy(GetAll<__Type>(__tag).FirstOrDefault()); - + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Low), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] + public void Destroy<__Type>([DebugAttributes.NotNull] string __tag) where __Type : Component => Destroy(GetAll<__Type>(__tag).FirstOrDefault()); + } \ No newline at end of file diff --git a/AwperativeKernel/Kernel/Debug/Debug.cs b/AwperativeKernel/Kernel/Debug/Debug.cs deleted file mode 100644 index 8edcb95..0000000 --- a/AwperativeKernel/Kernel/Debug/Debug.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; - - - -namespace AwperativeKernel; - - -public static class Debug -{ - - - - /// - /// True path of the log file Awperative dumps to. - /// - public static string LogFilePath { get; private set; } - - - - public static string LogFileName { get; private set; } = "Log"; - - - - - - /// - /// Sets up the Awperative debugger and finds the log file. - /// - internal static void Initiate() { - string directoryPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - if(directoryPath == null) throw new Exception("Failed to get directory path!"); - - LogFilePath = Path.Join(directoryPath, LogFileName + ".awlf"); - - if(!Directory.GetFiles(directoryPath).Contains(LogFileName + ".awlf")) { File.Create(LogFilePath).Close(); } - } - - - - /// - /// Writes the current message to the log file. - /// - /// Message to debug - public static void LogAction(string __message) => LogGeneric(__message, "ACT", [], []); - - /// - /// 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 LogAction(string __message, string[] __parameters, string[] __values) => LogGeneric(__message, "ACT", __parameters, __values); - - /// - /// Writes the current message to the log file if the condition is true. - /// - /// Condition to debug - /// Message to debug - public static void AssertAction(bool __condition, string __message) => AssertGeneric(__condition, __message, "ACT", [], []); - - - - - - /// - /// Writes the current message to the log file. - /// - /// Message to debug - 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 if the condition is true. - /// - /// Condition to debug - /// Message to debug - public static void AssertState(bool __condition, string __message) => AssertGeneric(__condition, __message, "STA", [], []); - - - - - - /// - /// 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 if the condition is true. - /// - /// Condition to debug - /// Message to debug - public static void AssertValue(bool __condition, string __message) => AssertGeneric(__condition, __message, "VAL", [], []); - - - - - - /// - /// 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); - - /// - /// Writes the current message to the log file if the condition is true. - /// - /// Condition to debug - /// Message to debug - public static void AssertWarning(bool __condition, string __message) => AssertGeneric(__condition, __message, "WAR", [], []); - - - - - - /// - /// Writes the current message to the log file. - /// - /// Message to debug - public static void LogError(string __message) => LogGeneric(__message, "ERR", [], [], ThrowExceptions); - - /// - /// 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 LogError(string __message, string[] __parameters, string[] __values) { - if(DebugErrors) LogGeneric(__message, "ERR", __parameters, __values, ThrowExceptions); - } - - /// - /// Writes the current message to the log file if the condition is true. - /// - /// Condition to debug - /// Message to debug - public static void AssertError(bool __condition, string __message) => AssertGeneric(__condition, __message, "ERR", [], []); - - - - - - /// - /// Writes the current message to the log file. With any given call sign. - /// - /// Message to debug - /// Message identifier - /// Names of values to debug - /// Values to debug - /// Should this throw an exception instead - public static void LogGeneric(string __message, string __callSign, string[] __parameters, string[] __values, bool __exception = false) { - 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]; - - if (__exception) throw new Exception(output); - - File.AppendAllText(LogFilePath, output); - } - - - - - - /// - /// Writes the current message to the log file if the condition is true. With any given call sign. - /// - /// Condition to debug - /// Message to debug - /// Message identifier - /// Names of values to debug - /// Values to debug - public static void AssertGeneric(bool __condition, string __message, string __callSign, string[] __parameters, string[] __values) { - if (!__condition) return; - - 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); - } - - - - public static Debug.SafetyLevel safetyLevel { - get => _safetyLevel; - set { - ThrowExceptions = value is Debug.SafetyLevel.Extreme; - IgnoreErrors = value is Debug.SafetyLevel.Low or Debug.SafetyLevel.None; - DebugErrors = value is not Debug.SafetyLevel.None; - _safetyLevel = value; - } - } - - private static Debug.SafetyLevel _safetyLevel; - public static bool ThrowExceptions { get; private set; } = false; - public static bool IgnoreErrors { get; private set; } = false; - public static bool DebugErrors { get; private set; } = true; - - public enum SafetyLevel { - Extreme, //Throw exceptions and stop the whole program - Normal, //Just debug it to the console, and halt current process - Low, //Push through tasks but debug error - None, //Ignore most/all errors and do not debug it, - } -} \ No newline at end of file diff --git a/AwperativeKernel/Kernel/Debug/Debug.md b/AwperativeKernel/Kernel/Debug/Debug.md deleted file mode 100644 index 596ef57..0000000 --- a/AwperativeKernel/Kernel/Debug/Debug.md +++ /dev/null @@ -1,5 +0,0 @@ -Awperative debugger writes errors to file while staying within runtime. - -Searches for a file with any specifiable name in config. that must end in .awlf - -stands for awperative logging format. \ No newline at end of file diff --git a/AwperativeKernel/Kernel/Inspector/Show.cs b/AwperativeKernel/Kernel/Inspector/Show.cs deleted file mode 100644 index 8636783..0000000 --- a/AwperativeKernel/Kernel/Inspector/Show.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - - -namespace AwperativeKernel; - - -[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] -public class Show : Attribute -{ - public bool UseInspectorDefaults = true; -} \ No newline at end of file diff --git a/AwperativeKernel/Kernel/Overhead/Awperative/Awperative.cs b/AwperativeKernel/Kernel/Overhead/Awperative/Awperative.cs index 69d53a1..c1c4e68 100644 --- a/AwperativeKernel/Kernel/Overhead/Awperative/Awperative.cs +++ b/AwperativeKernel/Kernel/Overhead/Awperative/Awperative.cs @@ -17,25 +17,19 @@ public static partial class Awperative { - /// - /// Current Version of Awperative - /// + /// Current Version of Awperative public static string Version = "1.2C"; - /// - /// Bottom class of Awperative. Contains the OpenTK Instance. - /// + /// Bottom class of Awperative. Contains the OpenTK Instance. [DebugAttributes.NotNull, MarkerAttributes.UnsafeInternal] private static Base Base; - /// - /// List of all scenes currently loaded in the kernel. - /// + /// List of all scenes currently loaded in the kernel. [MarkerAttributes.CalculatedProperty] - public static IEnumerable Scenes => [.._scenes]; + public static IReadOnlySet Scenes => _scenes; [MarkerAttributes.UnsafeInternal] internal static HashSet _scenes { get; private set; } = []; @@ -47,14 +41,17 @@ public static partial class Awperative - /// Awperative's debugger of choice + /// Awperative's debugger of choice, found from the module manager. + [MarkerAttributes.UnsafeInternal] public static IDebugger Debug { get; set; } - public static IModuleManager ModuleManager { get; set; } + /// Awperative's module manager of choice, sent in through the Start() function + [MarkerAttributes.UnsafeInternal] + public static IModuleManager ModuleManager { get; private set; } + - /// - /// Creates a new Scene - /// + /// Creates a new Scene with the given name + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Low), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] public static Scene CreateScene(string __name) { if (!ContainsScene(__name)) { Scene newScene = new Scene(__name); @@ -65,6 +62,7 @@ public static partial class Awperative + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Low), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.O1)] public static void AddScene(Scene __scene) { if (!ContainsScene(__scene.Name)) { _scenes.Add(__scene); @@ -73,46 +71,33 @@ public static partial class Awperative - /// - /// Finds a Scene from a given name - /// - /// Name to search for - /// + /// Finds a Scene from a given name + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] public static Scene GetScene(string __name) => _scenes.FirstOrDefault(scene => scene.Name == __name, null); - /// - /// Returns bool based on whether there a scene with the given name or not. - /// - /// Name of the Scene - /// + /// Returns bool based on whether there a scene with the given name or not. + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] public static bool ContainsScene(string __name) => _scenes.Any(scene => scene.Name == __name); - /// - /// Closes a Scene - /// - /// Scene to close + /// Closes a Scene + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] public static void CloseScene(Scene __scene) => _scenes.Remove(__scene); - /// - /// Closes a Scene - /// - /// Name of the scene + /// Closes a Scene + [MarkerAttributes.Expense(MarkerAttributes.Expense.ExpenseLevel.Medium), MarkerAttributes.Complexity(MarkerAttributes.Complexity.TimeComplexity.ON)] public static void CloseScene(string __name) => _scenes.Remove(GetScene(__name)); - /// - /// Gets Awperative ready to begin! Compiles Component functions etc. Please call before doing anything Awperative - /// related! - /// + /// Gets Awperative ready to begin! Compiles Component functions etc. Please call before doing anything Awperative related! public static void Start(string moduleManagerPath) { if (IsStarted) return; IsStarted = true; diff --git a/AwperativeKernel/obj/AwperativeKernel.csproj.nuget.dgspec.json b/AwperativeKernel/obj/AwperativeKernel.csproj.nuget.dgspec.json index 9bb9d23..93d3527 100644 --- a/AwperativeKernel/obj/AwperativeKernel.csproj.nuget.dgspec.json +++ b/AwperativeKernel/obj/AwperativeKernel.csproj.nuget.dgspec.json @@ -1,20 +1,20 @@ { "format": 1, "restore": { - "/home/avery/Projects/Awperative/AwperativeKernel/AwperativeKernel/AwperativeKernel.csproj": {} + "/Users/averynorris/RiderProjects/AwperativeKernel/AwperativeKernel/AwperativeKernel.csproj": {} }, "projects": { - "/home/avery/Projects/Awperative/AwperativeKernel/AwperativeKernel/AwperativeKernel.csproj": { + "/Users/averynorris/RiderProjects/AwperativeKernel/AwperativeKernel/AwperativeKernel.csproj": { "version": "1.0.0", "restore": { - "projectUniqueName": "/home/avery/Projects/Awperative/AwperativeKernel/AwperativeKernel/AwperativeKernel.csproj", + "projectUniqueName": "/Users/averynorris/RiderProjects/AwperativeKernel/AwperativeKernel/AwperativeKernel.csproj", "projectName": "AwperativeKernel", - "projectPath": "/home/avery/Projects/Awperative/AwperativeKernel/AwperativeKernel/AwperativeKernel.csproj", - "packagesPath": "/home/avery/.nuget/packages/", - "outputPath": "/home/avery/Projects/Awperative/AwperativeKernel/AwperativeKernel/obj/", + "projectPath": "/Users/averynorris/RiderProjects/AwperativeKernel/AwperativeKernel/AwperativeKernel.csproj", + "packagesPath": "/Users/averynorris/.nuget/packages/", + "outputPath": "/Users/averynorris/RiderProjects/AwperativeKernel/AwperativeKernel/obj/", "projectStyle": "PackageReference", "configFilePaths": [ - "/home/avery/.nuget/NuGet/NuGet.Config" + "/Users/averynorris/.nuget/NuGet/NuGet.Config" ], "originalTargetFrameworks": [ "net8.0" @@ -38,7 +38,7 @@ "auditLevel": "low", "auditMode": "direct" }, - "SdkAnalysisLevel": "9.0.300" + "SdkAnalysisLevel": "10.0.100" }, "frameworks": { "net8.0": { @@ -63,11 +63,11 @@ "downloadDependencies": [ { "name": "Microsoft.AspNetCore.App.Ref", - "version": "[8.0.24, 8.0.24]" + "version": "[8.0.23, 8.0.23]" }, { "name": "Microsoft.NETCore.App.Ref", - "version": "[8.0.24, 8.0.24]" + "version": "[8.0.23, 8.0.23]" } ], "frameworkReferences": { @@ -75,7 +75,7 @@ "privateAssets": "all" } }, - "runtimeIdentifierGraphPath": "/home/avery/.dotnet/sdk/9.0.311/PortableRuntimeIdentifierGraph.json" + "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.102/PortableRuntimeIdentifierGraph.json" } } } diff --git a/AwperativeKernel/obj/AwperativeKernel.csproj.nuget.g.props b/AwperativeKernel/obj/AwperativeKernel.csproj.nuget.g.props index 08dec0c..25b6aa4 100644 --- a/AwperativeKernel/obj/AwperativeKernel.csproj.nuget.g.props +++ b/AwperativeKernel/obj/AwperativeKernel.csproj.nuget.g.props @@ -4,12 +4,12 @@ True NuGet $(MSBuildThisFileDirectory)project.assets.json - /home/avery/.nuget/packages/ - /home/avery/.nuget/packages/ + /Users/averynorris/.nuget/packages/ + /Users/averynorris/.nuget/packages/ PackageReference - 6.14.0 + 7.0.0 - + \ No newline at end of file diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfo.cs b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfo.cs index ff95b26..bbec80c 100644 --- a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfo.cs +++ b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("AwperativeKernel")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+41dbab5ce36d1e19917d80ba23482cbbd5b04533")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+daff25af555790c4cc665d8158c8ec80cf2d5cf2")] [assembly: System.Reflection.AssemblyProductAttribute("AwperativeKernel")] [assembly: System.Reflection.AssemblyTitleAttribute("AwperativeKernel")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfoInputs.cache b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfoInputs.cache index e5ec2db..84431c9 100644 --- a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfoInputs.cache +++ b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfoInputs.cache @@ -1 +1 @@ -b1a9e115a38433219f1f2e46313d2b5f0dd905c9ce83715b972f620249d7097d +0205d8c69e5e58efd9ceec6d025aa71702700c3efb6b0341b64d64d2efcda724 diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.GeneratedMSBuildEditorConfig.editorconfig b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.GeneratedMSBuildEditorConfig.editorconfig index cbacfa1..cb335e2 100644 --- a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.GeneratedMSBuildEditorConfig.editorconfig +++ b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.GeneratedMSBuildEditorConfig.editorconfig @@ -1,5 +1,7 @@ is_global = true build_property.TargetFramework = net8.0 +build_property.TargetFrameworkIdentifier = .NETCoreApp +build_property.TargetFrameworkVersion = v8.0 build_property.TargetPlatformMinVersion = build_property.UsingMicrosoftNETSdkWeb = build_property.ProjectTypeGuids = @@ -8,7 +10,7 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Awperative -build_property.ProjectDir = /home/avery/Projects/Awperative/AwperativeKernel/AwperativeKernel/ +build_property.ProjectDir = /Users/averynorris/RiderProjects/AwperativeKernel/AwperativeKernel/ build_property.EnableComHosting = build_property.EnableGeneratedComInterfaceComImportInterop = build_property.EffectiveAnalysisLevelStyle = 8.0 diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.assets.cache b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.assets.cache index 3412d3519a672cb57dcb427ab0080be30f985d0a..8dcee15461c66139f60714b33e562a45a82897bf 100644 GIT binary patch literal 8640 zcmd5?UsK#v6sO8xp|k}p2&IZukSYlkSh4;^{&lBV8KBjNj$_!|g$&swlVpMY06ODC zeQ?GXpM3De@#FN(H@|`3K!0a*?{dgyyGe)Ll9{v1JvsND-@Q5eJ2&UDb$?@dprfPX zZvTIegL@snE{LCuwI_eA{r>mFlb@fC{;~brzfU{jfq4z>UoJfl8ufDk$@qp}Df&i9 z9J~HudU)!GvKfuAu14T^ugCC?p#4J{yg?-hMM?9^PH2?`Jx0&6L8Zb!vI-*5%1&Su zg`Ok6R78n}z7zG^mi>sisNat2_psWJLmZV5U&l95=oo}9`pvh7zddu0e%Ewy{%##_ zGl!hFTfx`N73b>=w4nmCSs<$L)0j)n(;1#!27YGFI6t?ZmziVE%NZ6nGaoaToR8bd z!wdrF;r8+`1Ht+C!tpM{$$2+on&^}E5Z%#ck`x1cUrCBVsUY6O#*kF~HI-j&Uy*I~ z`y(4QPIV7MiXmylb{3>oeO1cmroJ$(Ak_Bl;xVa5624n(4d-0o)Hz039CLwP@Zb4{_TPe~t%vzX$PD*xr z6A*LQ>IB4G@dVVGY`~ngHybd=?aBts<%`M&48n`c1`Nc7&ISx8&juG^_syX3-8Ye5 z#y9J1RTJVKx`>7On>8``+mLr4Q;=!MyO0@3>vrWRZ74vT6zLs=swqi;ZbRRST|0xq zNt2*Zl_d$vd(datd}iL&Ge~?_Pmm}^k|4bgeQS80f#Ez)U}#5`1ZEcc*1r`nU_1{H zFsjxh0n?z*@Zd7PH84m#PY@)k;v_-Rp>O9~1%t@*2tlOkP7=g9=-d0&!9emnLm;W@ zlLYb(^cU`}gw2EJA({tOgOcX)0rVFkPci5`PZ4yg5+y;Ohn~`jNU_Oxqsl*f@zLkC z1yr;a7Iazo3Q*f}$|tiYxdq)pE%!)Jv5Vf3w7}KoiLB{bfKWnPgb=zMgwTBm;R%iO zOOTHscOf4`4$cdy8=TAK71#x(xaLyr80v&7VI#e89BrM(g<{oF{=KJ%L<-5Xe=?`GQ=^sUU3%at+Rt zK$4z7u0sgq21H%=@W%DQ4^@u1S#PRt(Wq)_)tX8I*4lYdLak-8erQ&S zq0to>Rf$Oeqi&ITqiW1ly`y-+hPpQ_*i1jGKRf?OU({K8)`)6-HxrI5QdWYxsz(ls z(o41@ht3B$WRc~!9vPs+`5<5NY^z{}c4bu*Ek~GL>xLbO-fa=M_K`3Z&ZG)sCE1n6bcD zLA2sV5iYA^np$Rh^lF@1xL%h7#{yFI+_bkY=M6 zf#vL8m9wYPRMZ+en&~scHBOYHjqG}8DD<1G88k{`r$fXndSp8`L_(5@4RLA_4Y8E_A0k7uasU7T delta 1183 zcmZva%PT~26vt=W;SPR`%jGwh$@N%y&V@=PI*S&K}kNR2HE zQjD@9{{cz1b|@(pEKJG0Wij{u&TsRp^F8O=`Sd+E&Cd-jfv)yOVzb%86`}X_g@=F? zYaQD@xZ2$sxPHBR2{k$C$*d@IT5X};^#3yTzgL-@o*GxQ#qqf%hzM=bsE70=*UlVn z*hy1>x67o*DqQAP!>Zjw`mI8k_rjMxVX`-@>Qg$&khQzpslr=|%-SSGAA~p$nJ`b3 zLBOTLCnuATNpJ;W%^_!P+D%nQjI1RWwA4NGUJ;=g{Am>9Zo`->ppvKTvSGf%>}&8o z@l6=7pB+z#UifxWoOLOkvaG-9lwnxLi?~jggCifq^klKO;XkRX?#TwWxCPIW~!nMs