コード例 #1
0
 public Task <Request> Execute(RequestSetting requestSetting)
 {
     taskCompletionSource = new System.Threading.Tasks.TaskCompletionSource <Request>();
     Status = RequestStatus.Requesting;
     mClient.Client.Connect();
     if (mClient.Client.IsConnected)
     {
         try
         {
             PipeStream pipeStream = mClient.Client.Stream.ToPipeStream();
             Status = RequestStatus.Responding;
             requestSetting.Write(pipeStream);
             mClient.Client.Stream.Flush();
         }
         catch (Exception e_)
         {
             try
             {
                 if (mClient.Client != null)
                 {
                     mClient.Client.DisConnect();
                 }
                 Code = REQUEST_WRITE_ERROR;
             }
             finally
             {
                 OnCompleted();
             }
         }
     }
     return(taskCompletionSource.Task);
 }
コード例 #2
0
 public RequestSetting Get(string id)
 {
     if (!mRequestCase.TryGetValue(id, out RequestSetting result))
     {
         result = new RequestSetting();
     }
     return(result);
 }
コード例 #3
0
        public bool Modif(RequestSetting requestSetting)
        {
            bool result = mRequestCase.ContainsKey(requestSetting.ID);

            mRequestCase[requestSetting.ID] = requestSetting;
            Save();
            return(result);
        }
コード例 #4
0
        public void Add(RequestSetting requestSetting)
        {
            Uri uri = new Uri(Setting.Host);
            TestRequestSetting item = new TestRequestSetting();

            requestSetting.Build(uri.Host, uri.Port);
            item.RequestSetting  = requestSetting;
            item.Statistics.Name = requestSetting.BaseUrl;
            Items.Add(item);
        }
コード例 #5
0
        public async Task <Request.TestResult> TestCase(RequestSetting requestSetting, string host)
        {
            Uri uri = new Uri(host);

            using (HttpTcpClient httpTcpClient = new HttpTcpClient(uri.Host, uri.Port))
            {
                requestSetting.Build(uri.Host, httpTcpClient.Port);
                Request request = new Request(httpTcpClient);
                var     result  = await request.Execute(requestSetting);

                return(request.GetResult());
            }
        }
コード例 #6
0
 public bool Save(RequestSetting requestSetting)
 {
     return(UseCaseStorage.Default.Modif(requestSetting));
 }