Пример #1
0
 public CheatCommandMethod(MethodInfo InMethod, CheatCommandEntryAttribute InEntryAttr, CheatCommandEntryMethodAttribute InMethodAttr)
 {
     this.Method      = InMethod;
     this.CommandName = new MethodCheatCommandName(string.Format("{0}/{1}", InEntryAttr.group, InMethodAttr.comment), InMethod.Name);
     this.MethodAttr  = InMethodAttr;
     char[]   separator = new char[] { '/' };
     string[] strArray  = this.MethodAttr.comment.Split(separator);
     this.Comment = ((strArray == null) || (strArray.Length <= 0)) ? this.Method.Name : strArray[strArray.Length - 1];
     this.CacheArgumentDescriptions();
     base.ValidateArgumentsBuffer();
 }
Пример #2
0
 public CheatCommandMethod(MethodInfo InMethod, CheatCommandEntryAttribute InEntryAttr, CheatCommandEntryMethodAttribute InMethodAttr)
 {
     this.Method      = InMethod;
     this.CommandName = new CheatCommandMethod.MethodCheatCommandName(string.Format("{0}/{1}", InEntryAttr.group, InMethodAttr.comment), InMethod.get_Name());
     this.MethodAttr  = InMethodAttr;
     string[] array = this.MethodAttr.comment.Split(new char[]
     {
         '/'
     });
     this.Comment = ((array == null || array.Length <= 0) ? this.Method.get_Name() : array[array.Length - 1]);
     this.CacheArgumentDescriptions();
     base.ValidateArgumentsBuffer();
 }
Пример #3
0
    protected void RegisterMethods(Type InType)
    {
        CheatCommandEntryAttribute cheatCommandEntryAttribute = (CheatCommandEntryAttribute)InType.GetCustomAttributes(typeof(CheatCommandEntryAttribute), false)[0];

        DebugHelper.Assert(cheatCommandEntryAttribute != null);
        MethodInfo[] methods = InType.GetMethods();
        if (methods != null)
        {
            IEnumerator enumerator = methods.GetEnumerator();
            while (enumerator.MoveNext())
            {
                MethodInfo methodInfo = (MethodInfo)enumerator.get_Current();
                if (methodInfo.get_IsStatic())
                {
                    object[] customAttributes = methodInfo.GetCustomAttributes(typeof(CheatCommandEntryMethodAttribute), false);
                    if (customAttributes != null && customAttributes.Length > 0 && this.ValidateMethodArguments(methodInfo))
                    {
                        CheatCommandEntryMethodAttribute inMethodAttr = (CheatCommandEntryMethodAttribute)customAttributes[0];
                        this.RegisterMethod(InType, cheatCommandEntryAttribute, methodInfo, inMethodAttr);
                    }
                }
            }
        }
    }
Пример #4
0
    protected void RegisterMethods(Type InType)
    {
        CheatCommandEntryAttribute inEntryAttr = (CheatCommandEntryAttribute)InType.GetCustomAttributes(typeof(CheatCommandEntryAttribute), false)[0];

        DebugHelper.Assert(inEntryAttr != null);
        MethodInfo[] methods = InType.GetMethods();
        if (methods != null)
        {
            IEnumerator enumerator = methods.GetEnumerator();
            while (enumerator.MoveNext())
            {
                MethodInfo current = (MethodInfo)enumerator.Current;
                if (current.IsStatic)
                {
                    object[] customAttributes = current.GetCustomAttributes(typeof(CheatCommandEntryMethodAttribute), false);
                    if (((customAttributes != null) && (customAttributes.Length > 0)) && this.ValidateMethodArguments(current))
                    {
                        CheatCommandEntryMethodAttribute inMethodAttr = (CheatCommandEntryMethodAttribute)customAttributes[0];
                        this.RegisterMethod(InType, inEntryAttr, current, inMethodAttr);
                    }
                }
            }
        }
    }
Пример #5
0
    protected void RegisterMethod(Type InEntryType, CheatCommandEntryAttribute InEntryAttr, MethodInfo InMethod, CheatCommandEntryMethodAttribute InMethodAttr)
    {
        CheatCommandMethod inCommand = new CheatCommandMethod(InMethod, InEntryAttr, InMethodAttr);

        Singleton <CheatCommandsRepository> .instance.RegisterCommand(inCommand);
    }