private void ReadToEnd() { try { bool canRead = true; while (canRead) { Client c = new Client(Client.Server, Client.Port, Client.Encoding, Client.BufferSize); RequestBody rb = RequestBody.Create("ResponseStorageController", "ReadContent") .AddParameter("storageId", ResponseId) .AddParameter("length", Length); c.SendRequest(rb); OperationResult result = c.GetResult(); if (result.Entity == null) { canRead = false; } if (canRead) { ResponseStorage.Append(result.Entity); } } } catch (Exception ex) { throw new Exception($"Reading of the partitioned response was interrupted for the following reason: {ex.Message}"); } }
public void SendRequest(string controller, string action, object param = null) { RequestBody rb = RequestBody.Create(controller, action); if (param != null) { foreach (PropertyInfo info in param.GetType().GetProperties()) { rb.AddParameter(info.Name, info.GetValue(param)); } } SendRequest(rb); }