Esempio n. 1
0
 static extern int UWK_Update(ref Command cmd);
Esempio n. 2
0
 static extern uint UWK_PostCommand(ref Command command);
Esempio n. 3
0
 /// <summary>
 /// Ticks the plugin 
 /// </summary>
 public static void Update()
 {
     Command cmd = new Command ();
     while (true) {
         int ret = UWK_Update (ref cmd);
         if (ret != 0)
             ProcessCommand (ref cmd);
         else
             break;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Processes either a return or inbound command
        /// </summary>
        public static void ProcessCommand(ref Command cmd)
        {
            if (cmd.src == Source.PLUGIN) {

                if (ProcessReturn != null)
                    ProcessReturn (null, new CommandProcessEventArgs (cmd));

            } else {

                CommandProcessEventArgs args = new CommandProcessEventArgs (cmd);

                if (ProcessInbound != null) {
                    ProcessInbound (null, args);
                }

                // post return, ensuring that retcode is valid
                if (args.Cmd.retCode == 0)
                    args.Cmd.retCode = 1;

                PostCommand (ref args.Cmd);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Posts a command to the command queue and retrieves an id number
        /// </summary>
        public static void PostCommand(ref Command cmd)
        {
            cmd.id = UWK_PostCommand (ref cmd);

            if (cmd.id == 0)
                throw new Exception ("Unable to Post Command");
        }
Esempio n. 6
0
 public CommandProcessEventArgs(Command cmd)
 {
     this.Cmd = cmd;
 }
Esempio n. 7
0
 public CommandHandler(ref Command cmd)
 {
     this.cmd = cmd;
     Plugin.ProcessReturn += OnProcessReturn;
 }
Esempio n. 8
0
        /// <summary>
        /// Allocate a new command with the given fourcc and variable number of int/string parameters
        /// </summary>
        public static Command NewCommand(string fourcc, params object[] parms)
        {
            Command cmd = new Command ();
            cmd.Init ();
            cmd.fourcc = fourcc;

            foreach (object o in parms) {
                if (o.GetType () == typeof(int)) {
                    cmd.iParams[cmd.numIParams++] = (int)o;
                } else if (o.GetType () == typeof(float)) {
                    cmd.iParams[cmd.numIParams++] = (int) ((float) o );
                } else if (o.GetType () == typeof(string)) {
                    cmd.SetSParam (cmd.numSParams++, (string)o);
                } else {
                    throw new Exception ("Unknown command parameter type: " + o.GetType ());
                }
            }

            return cmd;
        }