protected override void BuildRequestBody() { // Sync RequestBody.Add("FileCount", Report.SyncResults.Stats.FileCount); RequestBody.Add("SavedFileCount", Report.SyncResults.Stats.SavedFileCount); // Sizes RequestBody.Add("TotalSize", FileSizeUtils.FileSizeToString(Report.SyncResults.Stats.TotalSize)); }
public void split(string request) { //read line by line using (StringReader reader = new StringReader(request)) { string line; //line int l = 0; //lines, starting from 0 while ((line = reader.ReadLine()) != null) { Console.WriteLine(line); // Request line by line ausgeben. if (l == 0) { Method = request.Split(' ')[0]; Url = request.Split(' ')[1]; Version = request.Split(' ', '\n')[2]; l++; } if (string.IsNullOrEmpty(line)) { break; } if (line.Contains(':') && l > 0) { string[] arr = line.Split(':'); string k = arr[0]; string v = arr[1].Trim(); RequestBody.Add(k, v); } l++; } if (ContentLength > 0) { char[] msg = new char[ContentLength]; // Read(Char[], Int32, Int32) // Reads a specified maximum of characters from the current stream // into a buffer, beginning at the specified index. reader.Read(msg, 0, ContentLength); // Char in String convert ContentStr = new string(msg); } else { ContentStr = ""; } if (String.Compare(Url, "/users") == 0 || String.Compare(Url, "/sessions") == 0) { acc = JsonConvert.DeserializeObject <User>(ContentStr); //Console.WriteLine(acc.Username); //Console.WriteLine(acc.Password); } } }
protected override void BuildRequestBody() { // Status RequestBody.Add("Status", Report.OperationStatus.ToString()); // Transfers RequestBody.Add("Total", Report.TransferResults.Stats.Total); RequestBody.Add("Pending", Report.TransferResults.Stats.Pending); RequestBody.Add("Running", Report.TransferResults.Stats.Running); RequestBody.Add("Failed", Report.VersionerResults.Stats.Failed + Report.TransferResults.Stats.Failed); RequestBody.Add("Canceled", Report.TransferResults.Stats.Canceled); RequestBody.Add("Completed", Report.TransferResults.Stats.Completed); // Sizes RequestBody.Add("TotalSize", FileSizeUtils.FileSizeToString(Report.TransferResults.Stats.BytesTotal)); RequestBody.Add("PendingSize", FileSizeUtils.FileSizeToString(Report.TransferResults.Stats.BytesPending)); RequestBody.Add("FailedSize", FileSizeUtils.FileSizeToString(Report.TransferResults.Stats.BytesFailed)); RequestBody.Add("CanceledSize", FileSizeUtils.FileSizeToString(Report.TransferResults.Stats.BytesCanceled)); RequestBody.Add("CompletedSize", FileSizeUtils.FileSizeToString(Report.TransferResults.Stats.BytesCompleted)); }