public static PastebinAPIResponse Parse(string s) { var response = new PastebinAPIResponse(); if (s.StartsWith(ErrorPrefix) == true) { response.Error = StringUtils.RemovePrefix(s, ErrorPrefix); } else { response.Value = s; } return(response); }
public string ProcessWebRequest(WebRequestParameter request) { using (var response = this.Explorer.Request(request)) { var str = response.ReadAsString(); var pResponse = PastebinAPIResponse.Parse(str); var error = pResponse.Error; if (string.IsNullOrWhiteSpace(error) == false) { throw new PastebinException(error); } return(pResponse.Value); } }