Пример #1
0
        public override IDebugEngineFactory CreateDebugEngineFactory()
        {
            ServiceManager serviceManager      = CreateServiceManager();
            var            joinableTaskContext = GetJoinableTaskContext();
            var            vsiService          = GetVsiService();

            joinableTaskContext.ThrowIfNotOnMainThread();

            var debugEngineCommands =
                new DebugEngineCommands(joinableTaskContext, null, false);

            var actionRecorder           = new ActionRecorder(GetDebugSessionMetrics());
            var backgroundProcessFactory = new BackgroundProcess.Factory();

            var processFactory = new ManagedProcess.Factory();
            var binaryFileUtil = new ElfFileUtil(processFactory);
            var lldbModuleUtil = new LldbModuleUtil();

            IModuleFileFinder moduleFileFinder = Substitute.For <IModuleFileFinder>();
            var moduleFileLoadRecorderFactory  =
                new ModuleFileLoadMetricsRecorder.Factory(lldbModuleUtil, moduleFileFinder);
            var grpcInterceptors = CreateGrpcInterceptors(vsiService.DebuggerOptions);
            var vsOutputWindow   =
                serviceManager.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
            var callInvokerFactory      = new PipeCallInvokerFactory();
            var transportSessionFactory =
                new LldbTransportSession.Factory(new MemoryMappedFileFactory());
            var yetiTransport = new YetiDebugTransport(
                joinableTaskContext, transportSessionFactory, callInvokerFactory,
                new GrpcConnectionFactory(joinableTaskContext.Factory, grpcInterceptors.ToArray()),
                GetTaskExecutor().CancelAsyncOperationIfRequested, processFactory, _dialogUtil,
                vsOutputWindow, vsiService);

            var chromeLauncher            = new ChromeLauncher(backgroundProcessFactory);
            var testClientLauncherFactory = new ChromeClientsLauncher.Factory(
                new ChromeClientLaunchCommandFormatter(GetJsonUtil()), GetSdkConfigFactory(),
                chromeLauncher);

            var exitDialogUtil         = new ExitDialogUtil(_dialogUtil, GetDialogExecutionContext());
            var preflightBinaryChecker =
                new PreflightBinaryChecker(GetFileSystem(), binaryFileUtil);

            var paramsFactory = new YetiVSI.DebugEngine.DebugEngine.Params.Factory(GetJsonUtil());

            var  cancelableTaskFactory  = GetCancelableTaskFactory();
            bool deployLldbServer       = true;
            IDebugEngineFactory factory = new YetiVSI.DebugEngine.DebugEngine.Factory(
                joinableTaskContext, serviceManager, GetDebugSessionMetrics(), yetiTransport,
                actionRecorder, null, moduleFileLoadRecorderFactory, moduleFileFinder,
                testClientLauncherFactory, GetNatvis(), GetNatvisDiagnosticLogger(),
                exitDialogUtil, preflightBinaryChecker, _debugSessionLauncherFactory, paramsFactory,
                _remoteDeploy, cancelableTaskFactory, _dialogUtil,
                GetNatvisLoggerOutputWindowListener(), GetSolutionExplorer(), debugEngineCommands,
                GetDebugEventCallbackDecorator(vsiService.DebuggerOptions),
                GetSymbolSettingsProvider(), deployLldbServer, _gameLauncher);

            return(GetFactoryDecorator().Decorate(factory));
        }
Пример #2
0
        public void TestLaunch()
        {
            var cl = new ChromeLauncher()
            {
                Address = new Uri("http://m.bbc.co.uk"),
            };

            cl.Run();
        }
        public void SetUp()
        {
            _backgroundProcessFactory = Substitute.For <BackgroundProcess.Factory>();
            _launchParams             = new LaunchParams();
            _sdkConfig = new SdkConfig();
            var sdkConfigFactory = Substitute.For <SdkConfig.Factory>();

            sdkConfigFactory.LoadOrDefault().Returns(c => _sdkConfig);
            var chromeLauncher = new ChromeLauncher(_backgroundProcessFactory);

            _chromeClientsLauncher =
                new ChromeClientsLauncher(sdkConfigFactory, _launchParams, chromeLauncher);
            _logSpy = new LogSpy();
            _logSpy.Attach();
        }
        /// <summary>
        /// Get services to web page
        /// </summary>
        public static async Task <(bool, Exception)> GetServicesAsHtml()
        {
            string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "service.html");

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            var start = new ProcessStartInfo
            {
                FileName               = "powershell.exe",
                UseShellExecute        = false,
                RedirectStandardOutput = true,
                Arguments              = "Get-Service | Select-Object Name, DisplayName, @{ n='Status'; e={ $_.Status.ToString() } }, @{ n='table'; e={ 'Status' } } | ConvertTo-html",
                CreateNoWindow         = true
            };

            using var process = Process.Start(start);
            using var reader  = process.StandardOutput;

            process.EnableRaisingEvents = true;

            var fileContents = await reader.ReadToEndAsync();

            await File.WriteAllTextAsync(fileName, fileContents);

            await process.WaitForExitAsync();

            try
            {
                ChromeLauncher.OpenLink(fileName);
                return(true, null);
            }
            catch (Exception ex)
            {
                return(false, ex);
            }
        }
Пример #5
0
        private void StartBrowser(string url)
        {
            this._WebBrowserExtendedState = Microsoft.Uii.Csr.Browser.Web.WebBrowserExtendedState.BrowserAcquiring;
            ChromeLauncher cl = new ChromeLauncher();

            _Process = cl.OpenLink(url);
            if (_Process == null)
            {
                throw new Exception("Unable to attach to browser.   Protected Mode may be disable");
            }
            _webBrowser           = cl.ChromeWindow;
            this._Process.Exited += _Process_Exited;
            this._Process.EnableRaisingEvents = true;
            this._WebBrowserExtendedState     = Microsoft.Uii.Csr.Browser.Web.WebBrowserExtendedState.BrowserAcquired;
            if (_webBrowser != IntPtr.Zero)
            {
                ManipulateWindow();
            }
            else
            {
                browserAquiredStart = DateTime.Now;
                browserAquiredTimer = new System.Threading.Timer(new TimerCallback(BrowserAquiredCheck), null, TimeSpan.FromMilliseconds(300), TimeSpan.Zero);
            }
        }