示例#1
0
        /// <summary>
        /// Register a method as a command
        /// </summary>
        /// <param name="Instance">The instance to register for</param>
        /// <param name="Method">The method</param>
        /// <param name="DefaultParams">Default parameters</param>
        public static void RegisterCommand(object Instance, MethodInfo Method, object[] DefaultParams = null)
        {
            if (Method == null)
            {
                return;
            }

            string HelpText = Method.Name;

            foreach (ParameterInfo ParamInfo in Method.GetParameters())
            {
                string ParamString = ParamInfo.ToString();
                int    DotIndex    = ParamString.LastIndexOf(".", StringComparison.Ordinal);
                if (DotIndex >= 0)
                {
                    ParamString = ParamString.Substring(DotIndex + 1);
                }

                HelpText += " [" + ParamString + "]";
            }

            RegisterCommand(Instance, Method, HelpText, DefaultParams);
        }
示例#2
0
 public override int GetHashCode()
 {
     return((base.GetHashCodeString() + ConstructType.ToString() + ParamInfo.ToString()).GetHashCode());
 }