Ejemplo n.º 1
0
 public OperationViewModel(IDumpService dumpService, IFileService fileService, IDialogService dialogService)
 {
     _dumpService   = dumpService;
     _fileService   = fileService;
     _dialogService = dialogService;
     DumpCommand    = new RelayCommand(DumpScreen);
     MessengerInstance.Register <DeviceAvailableMessage>(this, NewDeviceAvailable);
     MessengerInstance.Register <RequestDumpMessage>(this, (message) => DumpScreen());
     MessengerInstance.Register <SelectedDeviceChangedMessage>(this, SelectedDeviceChanged);
 }
Ejemplo n.º 2
0
 public DiagController(ILogger <DiagController> logger,
                       IServiceProvider serviceProvider)
 {
     _logger                  = logger;
     _diagnosticServices      = serviceProvider.GetRequiredService <IDiagnosticServices>();
     _diagnosticPortOptions   = serviceProvider.GetService <IOptions <DiagnosticPortOptions> >();
     _operationsStore         = serviceProvider.GetRequiredService <EgressOperationStore>();
     _dumpService             = serviceProvider.GetRequiredService <IDumpService>();
     _counterOptions          = serviceProvider.GetRequiredService <IOptionsMonitor <GlobalCounterOptions> >();
     _operationTrackerService = serviceProvider.GetRequiredService <OperationTrackerService>();
 }
Ejemplo n.º 3
0
    public async Task <IActionResult> DownloadAsJsonAsync([FromServices] IDumpService dumpService)
    {
        try
        {
            string json = await dumpService.GetGroupDataAsync(HttpContext.RequestAborted);

            return(File(Encoding.UTF8.GetBytes(json), "text/json", "groups.json"));
        }
        catch (InvalidOperationException ex)
        {
            _logger.LogError(ex, "Download as JSON");
            AddStatusMessage(_localizer["DownloadAsJsonAsync:UnknownError"], StatusMessageTypes.Error);
        }

        return(await RenderAsync(0, 0));
    }
Ejemplo n.º 4
0
        public async Task <ServerSourceHolder> StartServerAsync(EndpointInfoSourceCallback sourceCallback       = null, IDumpService dumpService = null,
                                                                OperationTrackerService operationTrackerService = null)
        {
            DiagnosticPortHelper.Generate(DiagnosticPortConnectionMode.Listen, out _, out string transportName);
            _outputHelper.WriteLine("Starting server endpoint info source at '" + transportName + "'.");

            List <IEndpointInfoSourceCallbacks> callbacks = new();

            if (null != sourceCallback)
            {
                callbacks.Add(sourceCallback);
                if (null != dumpService)
                {
                    callbacks.Add(new OperationTrackerServiceEndpointInfoSourceCallback(operationTrackerService));
                }
            }

            IOptions <DiagnosticPortOptions> portOptions = Extensions.Options.Options.Create(
                new DiagnosticPortOptions()
            {
                ConnectionMode = DiagnosticPortConnectionMode.Listen,
                EndpointName   = transportName
            });

            ServerEndpointInfoSource source = new(portOptions, callbacks, operationTrackerService);

            await source.StartAsync(CancellationToken.None);

            return(new ServerSourceHolder(source, transportName));
        }
Ejemplo n.º 5
0
 public CollectDumpAction(IServiceProvider serviceProvider, IEndpointInfo endpointInfo, CollectDumpOptions options)
     : base(endpointInfo, options)
 {
     _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     _dumpService     = serviceProvider.GetRequiredService <IDumpService>();
 }
Ejemplo n.º 6
0
 public ExportService(IApiService apiService, IDumpService dumpService)
 {
     _dumpService = dumpService;
     _apiService  = apiService;
 }