コード例 #1
0
ファイル: OsmpServer.cs プロジェクト: henon/OSMP
 private void UpdateCommandsAndEvents()
 {
     // cmds
     Commands.Clear();
     foreach (var type in GetCommandTypes())
     {
         var command = CreateInstance(type) as AbstractCommand;
         if (command == null)
         {
             continue;
         }
         if (!EnabledInstructionSets.Contains(command.InstructionSet))
         {
             continue;
         }
         RegisterCommand(command.Name, command, type);
         if (command.Name.Contains("-"))
         {
             RegisterCommand(command.Name.Replace("-", ""), command, type, is_alias: true); // allow to omit all dashes from a command like: do-this as well as dothis
         }
         foreach (var name in command.Aliases)
         {
             RegisterCommand(name, command, type, is_alias: true);
             if (name.Contains("-"))
             {
                 RegisterCommand(name.Replace("-", ""), command, type, is_alias: true); // allow to omit all dashes from a command like: do-this as well as dothis
             }
         }
     }
     // events
     Events.Clear();
     foreach (var type in GetEventTypes())
     {
         var evt = CreateInstance(type) as AbstractEvent;
         if (evt == null)
         {
             continue;
         }
         if (!EnabledInstructionSets.Contains(evt.InstructionSet))
         {
             continue;
         }
         RegisterEvent(evt.Name, evt, type);
     }
 }
コード例 #2
0
ファイル: OsmpServer.cs プロジェクト: henon/OSMP
 public void EnableInstructionSet(string group)
 {
     EnabledInstructionSets.Add(group);
     UpdateCommandsAndEvents();
 }