Esempio n. 1
0
 protected ProcedureCommand(Bulka.CommandLine.CommandLine commandLine, string[] argumentNames) : base(commandLine)
 {
     _argumentIndexes = new OneToOneMap <string, int>();
     for (var i = 0; i < argumentNames.Length; i++)
     {
         var name = argumentNames[i];
         if (_argumentIndexes.ContainsKey(name))
         {
             throw new Exception($"Duplicate argument '{name}'");
         }
         _argumentIndexes.Add(name, i);
     }
 }
Esempio n. 2
0
        public void AddCommand(string name, Command command, CommandMetaData metaData = null)
        {
            if (_commands.TryGetValue(name, out var otherCommand))
            {
                throw new Exception($"Cannot add command '{name}', it already exists: {otherCommand}");
            }
            _commands.Add(name, command);
            _infos.Add(command, metaData ?? new CommandMetaData(null, null));

            if (Debug)
            {
                UnityEngine.Debug.Log($"Added command: {command}");
            }
        }