public Language(String name, bool needsConvertion, String extension, [CanBeNull] MethodInfo executeMethod = null, [CanBeNull] MethodInfo convertMethod = null, [CanBeNull] object languageextension = null) { this.name = name; _folder = Application.dataPath + "/Mods/Scripts/" + name + "Scripts"; this.needsConvertion = needsConvertion; _defaultFile = Application.dataPath + "/Mods/Scripts/StandardScripts/" + name + "." + extension; _extension = extension; _extensionDot = "." + _extension; if (executeMethod == null) { _executeDeg = (ExecuteDeg)Delegate.CreateDelegate(typeof(ExecuteDeg), this, typeof(Language).GetMethod("Execute" + name)); } else { _executeDeg = (ExecuteDeg)Delegate.CreateDelegate(typeof(ExecuteDeg), languageextension, executeMethod); } if (needsConvertion) { if (convertMethod != null) { _convertDeg = (ConvertDeg)Delegate.CreateDelegate(typeof(ConvertDeg), languageextension, convertMethod); } else { _convertDeg = (ConvertDeg)Delegate.CreateDelegate(typeof(ConvertDeg), this, typeof(Language).GetMethod("Convert" + name)); } } InitializeScripts(); }
public Language(String name, bool needsConvertion, String extension, [CanBeNull] MethodInfo executeMethod = null, [CanBeNull] MethodInfo convertMethod = null, [CanBeNull] object languageextension = null) { this.name = name; _folder = Application.dataPath + "/Mods/Scripts/" + name + "Scripts"; this.needsConvertion = needsConvertion; _defaultFile = Application.dataPath + "/Mods/Scripts/StandardScripts/" + name + "." + extension; _extension = extension; _extensionDot = "." + _extension; if (executeMethod == null) { _executeDeg = (ExecuteDeg) Delegate.CreateDelegate(typeof (ExecuteDeg), this, typeof (Language).GetMethod("Execute" + name)); } else { _executeDeg = (ExecuteDeg)Delegate.CreateDelegate(typeof(ExecuteDeg), languageextension, executeMethod); } if (needsConvertion) { if (convertMethod != null) { _convertDeg = (ConvertDeg) Delegate.CreateDelegate(typeof (ConvertDeg), languageextension, convertMethod); } else { _convertDeg = (ConvertDeg) Delegate.CreateDelegate(typeof (ConvertDeg), this, typeof (Language).GetMethod("Convert" + name)); } } InitializeScripts(); }