Ejemplo n.º 1
0
 private void StopCmd(AbstractCommand command)
 {
     lock (_active_commands)
     {
         _active_commands.Remove(command.CmdNr);
     }
 }
Ejemplo n.º 2
0
 private void StartCmd(AbstractCommand command)
 {
     lock (_active_commands)
     {
         _active_commands[command.CmdNr] = command;
     }
 }
Ejemplo n.º 3
0
        public void SendStream(AbstractCommand cmd, JObject data)
        {
            var msg = new JObject
            {
                { "type", "stream" },
                { "nr", Interlocked.Increment(ref _command_counter) },
                { "cmd-nr", cmd.CmdNr },
                { "id", cmd.Name },
                { "data", data },
            };

            SendText(JsonConvert.SerializeObject(msg));
        }
Ejemplo n.º 4
0
 private void RegisterCommand(string name, AbstractCommand c, Type type, bool is_alias = false)
 {
     if (Commands.ContainsKey(name))
     {
         var existing = Commands[name];
         if (existing.Version > c.Version) // if version is equal, overwrite (due to compatibility). to ensure against overwriting, increase version number of the command.
         {
             return;
         }
     }
     Commands[name] = new CommandInfo
     {
         Name           = name,
         InstructionSet = c.InstructionSet,
         Version        = c.Version,
         Type           = type,
         IsAlias        = is_alias,
     };
 }