using XGame.Framework.Assertions; using System.Diagnostics; namespace XGame.Framework { public static partial class Assert { //public static void IsNull(T value) where T : class //{ // IsNull(value, null); //} //public static void IsNull(T value, string format, params object[] args) where T : class //{ // if (typeof(object).IsAssignableFrom(typeof(T))) // { // IsNull(value as object, format, args); // } // else if (value != null) // { // Fail(AssertionMessageUtil.NullFailureMessage(value, true), format, args); // } //} [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)] public static void IsNull(object value, string format, params object[] args) { if (value != null) Fail(AssertionMessageUtil.NullFailureMessage(value, true), format, args); } [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)] public static void IsNull(object value, T e) where T : System.Exception { if (value != null) Fail(AssertionMessageUtil.NullFailureMessage(value, true), e); } [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)] public static void IsNotNull(object value) { IsNotNull(value, null); } //public static void IsNotNull(T value) where T : class //{ // IsNotNull(value, null); //} //public static void IsNotNull(T value, string format, params object[] args) where T : class //{ // if (typeof(object).IsAssignableFrom(typeof(T))) // { // IsNotNull(value as object, format, args); // } // else if (value == null) // { // Fail(AssertionMessageUtil.NullFailureMessage(value, false), format, args); // } //} [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)] public static void IsNotNull(object value, string format, params object[] args) { if (value == null) Fail(AssertionMessageUtil.NullFailureMessage(value, false), format, args); } [Conditional(MacroDefine.XGAME_ASSERT), Conditional(MacroDefine.UNITY_EDITOR)] public static void IsNotNull(object value, T e) where T : System.Exception { if (value == null) Fail(AssertionMessageUtil.NullFailureMessage(value, false), e); } } }