Exemplo n.º 1
0
        public static void AddOneScriptDebug(this IServiceCollection services, IConfiguration config)
        {
            var debugPort = config.GetValue <int>("debug.port");

            if (debugPort != default)
            {
                var opts = new OscriptDebugOptions();
                opts.DebugPort   = debugPort;
                opts.WaitOnStart = config.GetValue <int>("debug.wait") > 0;

                services.AddTransient(sp => Options.Create(opts));

                var debugInfrastructure = new BinaryTcpDebugServer(debugPort);
                services.AddSingleton(sp => debugInfrastructure.CreateDebugController());
            }
        }
Exemplo n.º 2
0
        public override int Execute()
        {
            var executor = new ExecuteScriptBehavior(_path, _args);

            SystemLogger.SetWriter(executor);
            switch (ProtocolType)
            {
            case DebugProtocolType.Wcf:
                executor.DebugController = new WcfDebugController(_port);
                break;

            case DebugProtocolType.Tcp:
            default:
                var tcpDebugServer = new BinaryTcpDebugServer(_port);
                executor.DebugController = tcpDebugServer.CreateDebugController();
                break;
            }

            return(executor.Execute());
        }