private DebugProgram(DebugProperty.Factory debugPropertyFactory, IExtensionOptions options, DebugProcess process) { this.debugPropertyFactory = debugPropertyFactory; this.process = process; this.guid = Guid.NewGuid(); }
public void SetUp() { taskContext = new JoinableTaskContext(); mockMemoryMappedFileFactory = Substitute.For <MemoryMappedFileFactory>(); transportSessionFactory = new LldbTransportSession.Factory(mockMemoryMappedFileFactory); mockManagedProcessFactory = Substitute.For <ManagedProcess.Factory>(); mockGrpcCallInvoker = Substitute.ForPartsOf <PipeCallInvoker>(_numGrpcPipePairs); mockGrpcCallInvokerFactory = Substitute.For <PipeCallInvokerFactory>(); mockGrpcCallInvokerFactory.Create().Returns(mockGrpcCallInvoker); mockGrpcConnectionFactory = Substitute.For <GrpcConnectionFactory>(); optionPageGrid = Substitute.For <IExtensionOptions>(); service = new YetiVSIService(optionPageGrid); var mockVsOutputWindow = Substitute.For <IVsOutputWindow>(); mockDialogUtil = Substitute.For <IDialogUtil>(); yetiDebugTransport = new YetiDebugTransport(taskContext, transportSessionFactory, mockGrpcCallInvokerFactory, mockGrpcConnectionFactory, onAsyncRpcCompleted: null, managedProcessFactory: mockManagedProcessFactory, dialogUtil: mockDialogUtil, vsOutputWindow: mockVsOutputWindow, yetiVSIService: service); abortError = null; yetiDebugTransport.OnStop += e => { abortError = e; }; }
/// <summary> /// 将扩展选项导出为 JSON 文件。 /// </summary> /// <param name="options">给定的 <see cref="IExtensionOptions"/>。</param> /// <param name="filePath">给定要保存的文件名。</param> /// <returns>返回保存的路径字符串。</returns> public static string ExportAsJson(this IExtensionOptions options, string?filePath = null) { if (string.IsNullOrEmpty(filePath)) { filePath = options.BuildJsonFilePath(); } filePath.SerializeJsonFile(options); return(filePath); }
public static IEntityExtensions RegisterObject(object target, IExtensionOptions initializer) { if (target == null) { throw new ArgumentNullException("target"); } var entityExtensions = new EntityExtensions(target); entityExtensions.Initializer = initializer; return(entityExtensions); }
// Creates a DebugPortSupplier with specific factories. Used by tests. public DebugPortSupplier(DebugPort.Factory debugPortFactory, GameletClient.Factory gameletClientFactory, IExtensionOptions options, IDialogUtil dialogUtil, CancelableTask.Factory cancelableTaskFactory, IMetrics metrics, ICloudRunner cloudRunner, string developerAccount) { _debugPortFactory = debugPortFactory; _gameletClientFactory = gameletClientFactory; _dialogUtil = dialogUtil; _cancelableTaskFactory = cancelableTaskFactory; _metrics = metrics; _cloudRunner = cloudRunner; _developerAccount = developerAccount; }
public NatvisExpressionEvaluator(NatvisDiagnosticLogger logger, VsExpressionCreator vsExpressionCreator, IExtensionOptions extensionOptions, ExpressionEvaluationRecorder expressionEvaluationRecorder, ITimeSource timeSource) { _logger = logger; _vsExpressionCreator = vsExpressionCreator; // Instead of relying on the ExpressionEvaluationEngine flag directly, use // IExtensionOptions to get the flag. This will pick up configuration changes in // runtime. _extensionOptions = extensionOptions; _expressionEvaluationRecorder = expressionEvaluationRecorder; _timeSource = timeSource; }
public CoreAttachWindow(IServiceProvider serviceProvider) { var serviceManager = new ServiceManager(); _taskContext = serviceManager.GetJoinableTaskContext(); _dialogUtil = new DialogUtil(); IExtensionOptions options = ((YetiVSIService)serviceManager.RequireGlobalService(typeof(YetiVSIService))) .Options; var managedProcessFactory = new ManagedProcess.Factory(); var progressDialogFactory = new ProgressDialog.Factory(); _cancelableTaskFactory = new CancelableTask.Factory(_taskContext, progressDialogFactory); _coreListRequest = new CoreListRequest.Factory().Create(); var jsonUtil = new JsonUtil(); var credentialConfigFactory = new CredentialConfig.Factory(jsonUtil); var accountOptionLoader = new VsiAccountOptionLoader(options); var credentialManager = new CredentialManager(credentialConfigFactory, accountOptionLoader); _developerAccount = credentialManager.LoadAccount(); IRemoteCommand remoteCommand = new RemoteCommand(managedProcessFactory); _remoteFile = new RemoteFile(managedProcessFactory); var cloudConnection = new CloudConnection(); var sdkConfigFactory = new SdkConfig.Factory(jsonUtil); // NOTE: the lifetime of this CloudRunner is limited to the current CoreAttachWindow. _cloudRunner = new CloudRunner(sdkConfigFactory, credentialManager, cloudConnection, new GgpSDKUtil()); _gameletClientFactory = new GameletClient.Factory(); var sshKeyLoader = new SshKeyLoader(managedProcessFactory); var sshKnownHostsWriter = new SshKnownHostsWriter(); _sshManager = new SshManager(_gameletClientFactory, _cloudRunner, sshKeyLoader, sshKnownHostsWriter, remoteCommand); _debugSessionMetrics = new DebugSessionMetrics( serviceProvider.GetService(typeof(SMetrics)) as IMetrics); _debugSessionMetrics.UseNewDebugSessionId(); _actionRecorder = new ActionRecorder(_debugSessionMetrics); InitializeComponent(); _instanceSelectionWindowFactory = new ProjectInstanceSelection.Factory(); _paramsFactory = new DebugEngine.DebugEngine.Params.Factory(jsonUtil); SelectInstanceOnInit(); }
public Factory(CreateDebugPropertyDelegate createPropertyDelegate, VarInfoBuilder varInfoBuilder, VsExpressionCreator vsExpressionCreator, ErrorDebugProperty.Factory errorDebugPropertyFactory, IDebugEngineCommands debugEngineCommands, IExtensionOptions extensionOptions, ExpressionEvaluationRecorder expressionEvaluationRecorder, ITimeSource timeSource) { _createPropertyDelegate = createPropertyDelegate; _varInfoBuilder = varInfoBuilder; _vsExpressionCreator = vsExpressionCreator; _errorDebugPropertyFactory = errorDebugPropertyFactory; _debugEngineCommands = debugEngineCommands; _extensionOptions = extensionOptions; _expressionEvaluationRecorder = expressionEvaluationRecorder; _timeSource = timeSource; }
// Creates a DebugPortSupplier. This will be invoked by Visual Studio based on this class // Guid being in the registry. public DebugPortSupplier() { // Factory creation for the PortSupplier entry point. var serviceManager = new ServiceManager(); IExtensionOptions options = ((YetiVSIService)serviceManager.RequireGlobalService(typeof(YetiVSIService))) .Options; var taskContext = serviceManager.GetJoinableTaskContext(); var debugPropertyFactory = new DebugProperty.Factory(); var debugProgramFactory = new DebugProgram.Factory(debugPropertyFactory, options); var debugProcessFactory = new DebugProcess.Factory(debugProgramFactory); var managedProcessFactory = new ManagedProcess.Factory(); var processListRequestFactory = new ProcessListRequest.Factory(managedProcessFactory); var jsonUtil = new JsonUtil(); var sdkConfigFactory = new SdkConfig.Factory(jsonUtil); var credentialConfigFactory = new CredentialConfig.Factory(jsonUtil); var accountOptionLoader = new VsiAccountOptionLoader(options); var credentialManager = new CredentialManager(credentialConfigFactory, accountOptionLoader); _developerAccount = credentialManager.LoadAccount(); _dialogUtil = new DialogUtil(); var progressDialogFactory = new ProgressDialog.Factory(); _cancelableTaskFactory = new CancelableTask.Factory(taskContext, progressDialogFactory); var cloudConnection = new CloudConnection(); // NOTE: this CloudRunner is re-used for all subsequent Attach to Process windows. _cloudRunner = new CloudRunner(sdkConfigFactory, credentialManager, cloudConnection, new GgpSDKUtil()); var sshKeyLoader = new SshKeyLoader(managedProcessFactory); var sshKnownHostsWriter = new SshKnownHostsWriter(); _gameletClientFactory = new GameletClient.Factory(); var sshManager = new SshManager(_gameletClientFactory, _cloudRunner, sshKeyLoader, sshKnownHostsWriter, new RemoteCommand(managedProcessFactory)); _metrics = (IMetrics)serviceManager.RequireGlobalService(typeof(SMetrics)); _debugPortFactory = new DebugPort.Factory( debugProcessFactory, processListRequestFactory, _cancelableTaskFactory, _dialogUtil, sshManager, _metrics, _developerAccount); }
public void SetUp() { _debugPortFactory = Substitute.For <DebugPort.Factory>(); _gameletClient = Substitute.For <IGameletClient>(); var gameletClientFactory = Substitute.For <GameletClient.Factory>(); gameletClientFactory.Create(Arg.Any <ICloudRunner>()).Returns(_gameletClient); _dialogUtil = Substitute.For <IDialogUtil>(); _options = Substitute.For <IExtensionOptions>(); var cancelableTaskRunnerFactory = FakeCancelableTask.CreateFactory(new JoinableTaskContext(), false); _metrics = Substitute.For <IMetrics>(); _metrics.NewDebugSessionId().Returns(_testDebugSessionId); var cloudRunner = Substitute.For <ICloudRunner>(); _portSupplier = new DebugPortSupplier(_debugPortFactory, gameletClientFactory, _options, _dialogUtil, cancelableTaskRunnerFactory, _metrics, cloudRunner, _reserver); }
public EnabledExtension(IExtension extension, IExtensionOptions options) { Extension = extension; Options = options; }
/// <summary> /// 构建扩展选项的 JSON 文件路径(默认以扩展选项的配置目录为基础路径,以 <see cref="GetJsonFileName(Type)"/> 为文件名)。 /// </summary> /// <param name="options">给定的 <see cref="IExtensionOptions"/>。</param> /// <returns>返回路径字符串。</returns> public static string BuildJsonFilePath(this IExtensionOptions options) => options.GetType().GetJsonFileName().SetBasePath(options.Directories.ConfigDirectory);
/// <summary> /// Constructor. /// </summary> /// <param name="serviceProvider">Service provider.</param> /// <param name="options">Extension options.</param> public ShellGateway(IServiceProvider serviceProvider, IExtensionOptions options) { _serviceProvider = serviceProvider; _options = options; _projectsCache = new ProjectsCache(_serviceProvider); }
public Factory(DebugProperty.Factory debugPropertyFactory, IExtensionOptions options) { this.debugPropertyFactory = debugPropertyFactory; this.options = options; }
public static IEntityExtensions <T> RegisterTypedObject <T>(T target, IExtensionOptions initializer) { return(RegisterObject(target, initializer).GetTypeSafe <T>()); }
public VsiAccountOptionLoader(IExtensionOptions options) { this.options = options; }
public YetiVSIService(IExtensionOptions options) { Options = options; DebuggerOptions = new DebuggerOptions.DebuggerOptions(); }
public void SetUp() { _optionPage = OptionPageGrid.CreateForTesting(); }