Beispiel #1
0
        public async Task <string> HandleAsync(string url)
        {
            HttpClientLib clientLib = new HttpClientLib();
            var           startUrl  = url + "/Start/";
            string        response  = await clientLib.HttpConnectServerGet(startUrl);

            Logger.Instance.Info("成功发送Start指令,开始准备附加到进程");
            return(response);
        }
Beispiel #2
0
        public async Task <string> HandleAsync(string url)
        {
            HttpClientLib    clientLib       = new HttpClientLib();
            HttpClientExtend extendClientLib = new HttpClientExtend();
            var    remoteUrl          = url + @"/Remote/";
            var    test               = ((EnvDTE.DTE)ServiceProvider.GlobalProvider.GetService(typeof(EnvDTE.DTE).GUID)).FullName;
            var    vsInstallationPath = Path.GetFullPath(Path.Combine(test, @"..\"));
            var    remotefilepath     = vsInstallationPath + @"Remote Debugger\";
            var    contentR           = extendClientLib.SendFile(remotefilepath, HttpSeverLib.ConstantContext.zipRemoteFile);
            string response           = await clientLib.HttpConnectServer(remoteUrl, contentR);

            Logger.Instance.Info("成功发送Remote文件,并准备开始第三次发送");
            return(response);
        }
        public async Task <string> ClientTransFile()
        {
            HttpClientLib    clientLib       = new HttpClientLib();
            HttpClientExtend extendClientLib = new HttpClientExtend();

            try
            {
                var url      = $"http://{IP}:{Port}";
                var debugUrl = url + "/Debug/" + Active;

                //if (File.Exists(HttpSeverLib.ConstantContext.zipDebugFile))
                //{
                //    File.Delete(HttpSeverLib.ConstantContext.zipDebugFile);
                //}

                var content = extendClientLib.SendFile(SourceFileName, HttpSeverLib.ConstantContext.zipDebugFile);
                Logger.Instance.Info("开始请求服务端连接");
                _response = await clientLib.HttpConnectServer(debugUrl, content);

                Logger.Instance.Info("成功发送Debug文件,并准备开始第二次发送");

                IHandlerClient[] handlerClients = new HttpLib.IHandlerClient[]
                {
                    new ReciveDebugHandler(),
                    new ReciveRemoteHandler(),
                    new PortHandler(),
                };
                foreach (var tempHandle in handlerClients)
                {
                    if (tempHandle.CheckResponse(_response))
                    {
                        _response = await tempHandle.HandleAsync(url);
                    }
                }
                return(_response);
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");
                Console.WriteLine("Message :{0} ", e.Message);
                return("");
            }
        }