public bool ExecuteApi(string args, IntPtr streamHandle, IntPtr eventHandle)
 {
     IncreaseUse();
     try
     {
         using (var stream = new Native.Stream(new Native.switch_stream_handle(streamHandle, false)))
         using (var evt = eventHandle == IntPtr.Zero ? null : new Native.Event(new Native.switch_event(eventHandle, false), 0))
         {
             try
             {
                 var context = new ApiContext(args, stream, evt);
                 var plugin = createPlugin();
                 plugin.Execute(context);
                 return true;
             }
             catch (Exception ex)
             {
                 LogException("Execute", Name, ex);
                 return false;
             }
         }
     }
     finally
     {
         DecreaseUse();
     }
 }
 public void Execute(ApiContext context)
 {
     Script.contextType = ScriptContextType.Api;
     Script.context = context;
     try
     {
         entryPoint();
     }
     finally
     {
         Script.contextType = ScriptContextType.None;
         Script.context = null;
     }
 }
        public void Execute(ApiContext context)
        {
            var cmds = context.Arguments.Split(" ".ToCharArray());
            var cmd = cmds[0].ToLower();
            switch (cmd)
            {
                case "shutdown":
                    Shutdown();
                    break;

                default:
                    context.Stream.Write("\n\nInvalid Command\n\n");
                    break;
            }
        }
예제 #4
0
 public void Execute(ApiContext context)
 {
     throw new NotImplementedException();
 }