Ejemplo n.º 1
0
 static ModuleBuilder()
 {
     ModuleType = typeof(TModule);
     SetConstructor(ModuleType.GetConstructors().First());
     Context       = ModuleType.GetProperty("Context").DeclaringType.GetProperty("Context");
     BeforeExecute = ModuleType.GetRuntimeMethods().First(x => x.Name == "BeforeExecute");
 }
Ejemplo n.º 2
0
        // Get the value of a property of the ApplicationHook class of the modile
        /// <summary>
        /// Try and get the value of a property of a module
        /// </summary>
        /// <typeparam name="T">Datatype of the value</typeparam>
        /// <param name="name">Name of the value</param>
        /// <returns></returns>
        private T GetPropertyValue <T>(string name)
        {
            var pInfo = ModuleType.GetProperty(name);

            if (pInfo == null)
            {
                return(default(T));
            }

            try {
                var ob = pInfo.GetValue(Instance);
                if (ob == null)
                {
                    return(default(T));
                }
                else
                {
                    return((T)ob);
                }
            } catch { return(default(T)); }
        }