public XmlDocument WallPostFoto(int uid, InstaFoto foto) { // парсим урл для загрузки var result = GetWallUploadServer(uid); var uploadUrl = _network.GetDataFromXmlNode(result.SelectSingleNode("/response/upload_url")); //загружаем var uploadedPhoto = UploadFoto(uploadUrl, foto.Filename); //сохраняем result = SaveWallPhoto(uploadedPhoto); //парсим данные сохраненного фото uploadedPhoto.SavedID = _network.GetDataFromXmlNode(result.SelectSingleNode("/response/photo/id")); uploadedPhoto.SavedPID = _network.GetDataFromXmlNode(result.SelectSingleNode("/response/photo/pid")); uploadedPhoto.SavedOwnerID = _network.GetDataFromXmlNode(result.SelectSingleNode("/response/photo/owner_id")); //кодируем теги в урл-формате if (foto.Text.Contains("#")) { foto.Text = foto.Text.Replace("#", "%23"); } //постим на стену _qs["message"] = foto.Text + " " + foto.Link; _qs["attachments"] = uploadedPhoto.SavedID; return(ExecuteCommand("wall.post", _qs)); }
private WallPost GetWallPostFromXML(XmlDocument xmlPost) { var post = new WallPost { ID = _network.GetDataFromXmlNode(xmlPost.SelectSingleNode("response/post/id")), Date = _network.GetDataFromXmlNode(xmlPost.SelectSingleNode("response/post/date")), Text = _network.GetDataFromXmlNode(xmlPost.SelectSingleNode("response/post/text")), Comments = _network.GetDataFromXmlNode(xmlPost.SelectSingleNode("response/post/comments/count")), Likes = _network.GetDataFromXmlNode(xmlPost.SelectSingleNode("response/post/likes/count")), Reposts = _network.GetDataFromXmlNode(xmlPost.SelectSingleNode("response/post/reposts/count")) }; return(post); }