private IScriptLogic sc_try_create_Logic(string className) { if (className == null) { return(null); } IScriptLogic scriptLogic = null; foreach (Assembly assembly in NFinalizeDeath.GetAssemblies()) { scriptLogic = (IScriptLogic)assembly.CreateInstance(className); if (scriptLogic != null) { break; } } return(scriptLogic); }
public bool sc_create_Logic(string className) { if (__dontcall) { return(true); } var _this = (ScriptCore.ScriptProxy)(object) this; if (_this.mTarget != null) { return(true); } string p = null; try { className = ScriptCore.ScriptProxy.SubstituteClass(className); if (className == null) { return(false); } p = className; IScriptLogic scriptLogic = _this.TryCreateLogic(className); if (scriptLogic == null) { string text = ScriptCore.ScriptProxy.CreateLogicFailureName(className); if (text != null) { scriptLogic = _this.TryCreateLogic(text); if (scriptLogic == null) { throw new NullReferenceException("--- ERROR: Unable to create failure logic '" + text + "'. ---"); } } if (scriptLogic == null) { throw new NullReferenceException("--- ERROR: Unable to create logic type '" + className + "'. ---"); } } return(_this.SetLogic(scriptLogic, false)); } catch { if (p != null) { try { Type tpye = null; foreach (Assembly assembly in NFinalizeDeath.GetAssemblies()) { tpye = assembly.GetType(p, false); if (tpye != null) { break; } } if (tpye == null) { throw new NullReferenceException("--- ERROR: Could not find Class Name. ---"); } var constructor = tpye.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, CallingConventions.Any, new Type[0], null); if (constructor == null) { throw new NullReferenceException("--- ERROR: Could not find Constructor ctor() of " + tpye.FullName); } IScriptLogic s = (IScriptLogic)constructor.Invoke(null); if (s == null) { throw new NullReferenceException("--- ERROR: Failed to create IScriptLogic TypeName: '" + tpye.FullName + "'. ---"); } return(_this.SetLogic(s, false)); } catch (Exception) { } } return(true); } }