From f23f9692a2536d15752b236447d1e133314e80ae Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Fri, 14 Mar 2025 16:53:33 +0800 Subject: [PATCH] defines refactoring --- src/Aspect/EcsAspectAuto.cs | 5 ++++- src/Attributes/AspectAttributes.cs | 5 ++++- src/Attributes/InjectionAttributes.cs | 5 ++++- src/AutoInjectSystem.cs | 7 +++++-- src/AutoInjectSystemExtensions.cs | 6 +++++- src/AutoRunners/BindWithRunnerAttribute.cs | 6 +++++- src/AutoRunners/ProcessRunnerBinder.cs | 5 ++++- src/Utils/DummyInstance.cs | 5 ++++- src/Utils/Exceptions.cs | 5 ++++- src/Utils/ReflectionExtenions.cs | 5 ++++- 10 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/Aspect/EcsAspectAuto.cs b/src/Aspect/EcsAspectAuto.cs index 4e75041..ba47aaa 100644 --- a/src/Aspect/EcsAspectAuto.cs +++ b/src/Aspect/EcsAspectAuto.cs @@ -1,4 +1,7 @@ -using DCFApixels.DragonECS.AutoInjections.Internal; +#if DISABLE_DEBUG +#undef DEBUG +#endif +using DCFApixels.DragonECS.AutoInjections.Internal; using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Attributes/AspectAttributes.cs b/src/Attributes/AspectAttributes.cs index 7e2c976..ab75914 100644 --- a/src/Attributes/AspectAttributes.cs +++ b/src/Attributes/AspectAttributes.cs @@ -1,4 +1,7 @@ -using DCFApixels.DragonECS.PoolsCore; +#if DISABLE_DEBUG +#undef DEBUG +#endif +using DCFApixels.DragonECS.PoolsCore; using System; using System.Linq; diff --git a/src/Attributes/InjectionAttributes.cs b/src/Attributes/InjectionAttributes.cs index 5d4cc6b..7e4f47c 100644 --- a/src/Attributes/InjectionAttributes.cs +++ b/src/Attributes/InjectionAttributes.cs @@ -1,4 +1,7 @@ -using System; +#if DISABLE_DEBUG +#undef DEBUG +#endif +using System; namespace DCFApixels.DragonECS { diff --git a/src/AutoInjectSystem.cs b/src/AutoInjectSystem.cs index 224668f..0cf3b1d 100644 --- a/src/AutoInjectSystem.cs +++ b/src/AutoInjectSystem.cs @@ -1,3 +1,6 @@ +#if DISABLE_DEBUG +#undef DEBUG +#endif using DCFApixels.DragonECS.AutoInjections; using DCFApixels.DragonECS.AutoInjections.Internal; using System; @@ -63,7 +66,7 @@ namespace DCFApixels.DragonECS { return false; } -#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS +#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS if (!isAgressiveInjection && o.CanWrite == false) { Throw.PropertyIsCantWrite(o); } #endif return o.CanWrite == false; @@ -78,7 +81,7 @@ namespace DCFApixels.DragonECS return false; } var parameters = o.GetParameters(); -#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS +#if DEBUG || ENABLE_DRAGONECS_ASSERT_CHEKS if (!isAgressiveInjection) { if (o.IsGenericMethod) { Throw.MethodIsGeneric(o); } diff --git a/src/AutoInjectSystemExtensions.cs b/src/AutoInjectSystemExtensions.cs index 74d8179..27f6cb8 100644 --- a/src/AutoInjectSystemExtensions.cs +++ b/src/AutoInjectSystemExtensions.cs @@ -1,4 +1,8 @@ -namespace DCFApixels.DragonECS +#if DISABLE_DEBUG +#undef DEBUG +#endif + +namespace DCFApixels.DragonECS { public static class AutoInjectSystemExtensions { diff --git a/src/AutoRunners/BindWithRunnerAttribute.cs b/src/AutoRunners/BindWithRunnerAttribute.cs index 4facf65..0bd031e 100644 --- a/src/AutoRunners/BindWithRunnerAttribute.cs +++ b/src/AutoRunners/BindWithRunnerAttribute.cs @@ -1,4 +1,8 @@ -using System; +#if DISABLE_DEBUG +#undef DEBUG +#endif +using System; + [AttributeUsage(AttributeTargets.Interface, Inherited = false, AllowMultiple = false)] public sealed class BindWithRunnerAttribute : Attribute { diff --git a/src/AutoRunners/ProcessRunnerBinder.cs b/src/AutoRunners/ProcessRunnerBinder.cs index c382480..18849c4 100644 --- a/src/AutoRunners/ProcessRunnerBinder.cs +++ b/src/AutoRunners/ProcessRunnerBinder.cs @@ -1,4 +1,7 @@ -using DCFApixels.DragonECS.AutoInjections.Internal; +#if DISABLE_DEBUG +#undef DEBUG +#endif +using DCFApixels.DragonECS.AutoInjections.Internal; using System; using System.Reflection; diff --git a/src/Utils/DummyInstance.cs b/src/Utils/DummyInstance.cs index e0ad9bc..e79348b 100644 --- a/src/Utils/DummyInstance.cs +++ b/src/Utils/DummyInstance.cs @@ -1,4 +1,7 @@ -using System; +#if DISABLE_DEBUG +#undef DEBUG +#endif +using System; using System.Reflection; namespace DCFApixels.DragonECS diff --git a/src/Utils/Exceptions.cs b/src/Utils/Exceptions.cs index a9074aa..41b7f2f 100644 --- a/src/Utils/Exceptions.cs +++ b/src/Utils/Exceptions.cs @@ -1,4 +1,7 @@ -using System; +#if DISABLE_DEBUG +#undef DEBUG +#endif +using System; using System.Reflection; using System.Runtime.CompilerServices; diff --git a/src/Utils/ReflectionExtenions.cs b/src/Utils/ReflectionExtenions.cs index a9949cd..fea9d88 100644 --- a/src/Utils/ReflectionExtenions.cs +++ b/src/Utils/ReflectionExtenions.cs @@ -1,4 +1,7 @@ -using System; +#if DISABLE_DEBUG +#undef DEBUG +#endif +using System; using System.Reflection; using System.Runtime.CompilerServices;