コード例 #1
0
        /// <summary>
        /// Enable Debug Adapter Protocol for the running adapter.
        /// </summary>
        /// <param name="botAdapter">The <see cref="BotAdapter"/> to enable.</param>
        /// <param name="port">port to listen on.</param>
        /// <param name="sourceMap">ISourceMap to use (default will be SourceMap()).</param>
        /// <param name="breakpoints">IBreakpoints to use (default will be SourceMap()).</param>
        /// <param name="terminate">Termination function (Default is Environment.Exit().</param>
        /// <param name="events">IEvents to use (Default is Events).</param>
        /// <param name="codeModel">ICodeModel to use (default is internal implementation).</param>
        /// <param name="dataModel">IDataModel to use (default is internal implementation).</param>
        /// <param name="logger">ILogger to use (Default is NullLogger).</param>
        /// <param name="coercion">ICoercion to use (default is internal implementation).</param>
        /// <returns>The <see cref="BotAdapter"/>.</returns>
        public static BotAdapter UseDebugger(
            this BotAdapter botAdapter,
            int port,
            ISourceMap sourceMap     = null,
            IBreakpoints breakpoints = null,
            Action terminate         = null,
            IEvents events           = null,
            ICodeModel codeModel     = null,
            IDataModel dataModel     = null,
            ILogger logger           = null,
            ICoercion coercion       = null)
        {
            codeModel = codeModel ?? new CodeModel();
            DebugSupport.SourceMap = sourceMap ?? new DebuggerSourceMap(codeModel);

            return(botAdapter.Use(
                       new DialogDebugAdapter(
                           port: port,
                           sourceMap: DebugSupport.SourceMap,
                           breakpoints: breakpoints ?? DebugSupport.SourceMap as IBreakpoints,
                           terminate: terminate,
                           events: events,
                           codeModel: codeModel,
                           dataModel: dataModel,
                           logger: logger)));
        }
コード例 #2
0
 protected DataModelBase(ICoercion coercion)
 {
     this.coercion = coercion ?? throw new ArgumentNullException(nameof(coercion));
 }
コード例 #3
0
 public ListDataModel(ICoercion coercion)
     : base(coercion)
 {
 }
コード例 #4
0
 public DialogDebugAdapter(int port, ISourceMap sourceMap, IBreakpoints breakpoints, Action terminate, IEvents events = null, ICodeModel codeModel = null, IDataModel dataModel = null, ILogger logger = null, ICoercion coercion = null)
     : base(logger)
 {
     this.events = events ?? new Events<DialogEvents>();
     this.codeModel = codeModel ?? new CodeModel();
     this.dataModel = dataModel ?? new DataModel(coercion ?? new Coercion());
     this.sourceMap = sourceMap ?? throw new ArgumentNullException(nameof(sourceMap));
     this.breakpoints = breakpoints ?? throw new ArgumentNullException(nameof(breakpoints));
     this.terminate = terminate ?? new Action(() => Environment.Exit(0));
     this.task = ListenAsync(new IPEndPoint(IPAddress.Any, port), cancellationToken.Token);
 }
コード例 #5
0
        public DialogDebugAdapter(IDebugTransport transport, ISourceMap sourceMap, IBreakpoints breakpoints, Action terminate, IEvents events = null, ICodeModel codeModel = null, IDataModel dataModel = null, ILogger logger = null, ICoercion coercion = null)
        {
            _transport   = transport ?? throw new ArgumentNullException(nameof(transport));
            _events      = events ?? new Events <DialogEvents>();
            _codeModel   = codeModel ?? new CodeModel();
            _dataModel   = dataModel ?? new DataModel(coercion ?? new Coercion());
            _sourceMap   = sourceMap ?? throw new ArgumentNullException(nameof(sourceMap));
            _breakpoints = breakpoints ?? throw new ArgumentNullException(nameof(breakpoints));
            _terminate   = terminate ?? (() => Environment.Exit(0));
            _logger      = logger ?? NullLogger.Instance;
            _arenas.Add(_output);

            // lazily complete circular dependency
            _transport.Accept = AcceptAsync;
        }
コード例 #6
0
 public ReadOnlyDictionaryDataModel(ICoercion coercion)
     : base(coercion)
 {
 }
コード例 #7
0
 public ReflectionDataModel(ICoercion coercion)
     : base(coercion)
 {
 }
コード例 #8
0
 public DataModel(ICoercion coercion)
 {
     this.coercion = coercion ?? throw new ArgumentNullException(nameof(coercion));
 }
コード例 #9
0
 public EnumerableDataModel(ICoercion coercion)
     : base(coercion)
 {
 }
コード例 #10
0
 public DictionaryDataModel(ICoercion coercion)
     : base(coercion)
 {
 }