/// <summary> /// /// </summary> /// <param name="htmlDocument"></param> /// <returns></returns> public static PrivateMessageFolderEditor ParseEditFolderPage(HtmlDocument htmlDocument) { PrivateMessageFolderEditor request = null; var top = htmlDocument.DocumentNode; var inputArray = top.Descendants("input"); if (inputArray != null) { request = new PrivateMessageFolderEditor(); int highest = 0; var highestNode = inputArray .Where(node => node.GetAttributeValue("name", string.Empty).Equals("highest")) .FirstOrDefault(); if (highestNode != null) { int.TryParse(highestNode.GetAttributeValue("value", string.Empty), out highest); } request.HighestIndex = highest; var folderArray = inputArray.Where(node => node.GetAttributeValue("name", string.Empty).Contains("folderlist")); if (folderArray != null) { int maxFolderListIndex = 0; foreach (var item in folderArray) { string keyString = item.GetAttributeValue("name", string.Empty); string value = item.GetAttributeValue("value", string.Empty); keyString = keyString.Replace("folderlist", string.Empty); keyString = keyString.Replace("[", string.Empty); keyString = keyString.Replace("]", string.Empty); int key = 0; int.TryParse(keyString, out key); request.FolderTable.Add(key, value); maxFolderListIndex = Math.Max(maxFolderListIndex, key); } request.NewFolderFieldIndex = maxFolderListIndex; } } return request; }
public Task<bool> SaveChangesAsync(PrivateMessageFolderEditor editor) { return editor.CreateHttpRequestBuilder().SendAndConfirmAsync(this.Client); }