Esempio n. 1
0
 public static void find(ref ConsoleSystem.Arg arg)
 {
     string str;
     if (!arg.HasArgs(1))
     {
         return;
     }
     string args = arg.Args[0];
     string empty = string.Empty;
     Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
     for (int i = 0; i < (int)assemblies.Length; i++)
     {
         Type[] types = assemblies[i].GetTypes();
         for (int j = 0; j < (int)types.Length; j++)
         {
             if (types[j].IsSubclassOf(typeof(ConsoleSystem)))
             {
                 MethodInfo[] methods = types[j].GetMethods();
                 for (int k = 0; k < (int)methods.Length; k++)
                 {
                     if (methods[k].IsStatic)
                     {
                         if (!(args != "*") || types[j].Name.Contains(args) || methods[k].Name.Contains(args))
                         {
                             if (arg.CheckPermissions(methods[k].GetCustomAttributes(true)))
                             {
                                 str = empty;
                                 empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildMethodString(ref methods[k]), "\n" });
                             }
                         }
                     }
                 }
                 FieldInfo[] fields = types[j].GetFields();
                 for (int l = 0; l < (int)fields.Length; l++)
                 {
                     if (fields[l].IsStatic)
                     {
                         if (!(args != "*") || types[j].Name.Contains(args) || fields[l].Name.Contains(args))
                         {
                             if (arg.CheckPermissions(fields[l].GetCustomAttributes(true)))
                             {
                                 str = empty;
                                 empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildFieldsString(ref fields[l]), "\n" });
                             }
                         }
                     }
                 }
                 PropertyInfo[] properties = types[j].GetProperties();
                 for (int m = 0; m < (int)properties.Length; m++)
                 {
                     if (!(args != "*") || types[j].Name.Contains(args) || properties[m].Name.Contains(args))
                     {
                         if (arg.CheckPermissions(properties[m].GetCustomAttributes(true)))
                         {
                             str = empty;
                             empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildPropertyString(ref properties[m]), "\n" });
                         }
                     }
                 }
             }
         }
     }
     arg.ReplyWith(string.Concat("Finding ", args, ":\n", empty));
 }