コード例 #1
0
 public static void LoadAll()
 {
     //Logger.Console.WriteLine("&bLoadingCommands...");
     foreach (var ThisCmdDesciptorRaw in typeof(Commands).GetFields().Where(x => x.FieldType == typeof(CommandDescriptor)))
     {
         try
         {
             CommandDescriptor ThisCmdDescriptor = (CommandDescriptor)ThisCmdDesciptorRaw.GetValue(ThisCmdDesciptorRaw.FieldType); //(CommandDescriptor)Convert.ChangeType(ThisCmdDesciptorRaw.FieldType, typeof(CommandDescriptor));
             //Logger.Console.WriteLine("Found: " + ThisCmdDescriptor._Name);
             Register(ThisCmdDescriptor);
         }
         catch
         {
             Logger.Console.WriteLine("        Failed: " + ThisCmdDesciptorRaw.Name);
             continue;
         }
     }
     //Logger.Console.WriteLine("&bLoadingComplete.");
 }
コード例 #2
0
        public static void LoadAll()
        {
            //Logger.Console.WriteLine("&bLoadingCommands...");
            #region NORMAL COMMANDS
            foreach (var ThisCmdDesciptorRaw in typeof(Commands).GetFields().Where(x => x.FieldType == typeof(CommandDescriptor)).ToArray())
            {
                try
                {
                    CommandDescriptor ThisCmdDescriptor = (CommandDescriptor)ThisCmdDesciptorRaw.GetValue(ThisCmdDesciptorRaw.FieldType); //(CommandDescriptor)Convert.ChangeType(ThisCmdDesciptorRaw.FieldType, typeof(CommandDescriptor));
                    //Logger.Console.WriteLine("Found: " + ThisCmdDescriptor._Name);
                    Register(ThisCmdDescriptor);
                }
                catch (Exception e)
                {
                    Log.Error(e);
                    Console.WriteLine("&cOpenYS.Commands.LoadAll Failed: " + ThisCmdDesciptorRaw.Name);
                    continue;
                }
            }
            #endregion
            #region DEBUGGING COMMANDS
#if DEBUG
            foreach (var ThisCmdDesciptorRaw in typeof(Commands).GetFields().Where(x => x.FieldType == typeof(DebuggingCommandDescriptor)).ToArray())
            {
                try
                {
                    DebuggingCommandDescriptor ThisCmdDescriptor = (DebuggingCommandDescriptor)ThisCmdDesciptorRaw.GetValue(ThisCmdDesciptorRaw.FieldType); //(CommandDescriptor)Convert.ChangeType(ThisCmdDesciptorRaw.FieldType, typeof(CommandDescriptor));
                    //Logger.Console.WriteLine("Found: " + ThisCmdDescriptor._Name);
                    Register(ThisCmdDescriptor);
                }
                catch (Exception e)
                {
                    Log.Error(e);
                    Console.WriteLine("&cOpenYS.Commands.LoadAll Failed: " + ThisCmdDesciptorRaw.Name);
                    continue;
                }
            }
#endif
            #endregion
            //Logger.Console.WriteLine("&bLoadingComplete.");
        }