private HtmlDocument GetDeleteDocument(WebClientWithCookies client) { var content = client.DownloadString(this.GetPackageUrl()); var document = new HtmlDocument(); document.LoadHtml(content); return document; }
public void Delete() { using (var client = new WebClientWithCookies()) { this.PostSignIn(client); this.PostDelete(client); } }
private static HtmlDocument GetLogOnDocument(WebClientWithCookies client) { var content = client.DownloadString( "https://www.nuget.org/users/account/LogOn?returnUrl=%2F"); var document = new HtmlDocument(); document.LoadHtml(content); return document; }
private HtmlDocument GetDeleteDocument(WebClientWithCookies client) { var content = client.DownloadString(this.GetPackageUrl()); var document = new HtmlDocument(); document.LoadHtml(content); return(document); }
public void Delete() { using (var client = new WebClientWithCookies()) { this.PostSignIn(client); this.PostDelete(client); } }
private static HtmlDocument GetLogOnDocument(WebClientWithCookies client) { var content = client.DownloadString( "https://www.nuget.org/users/account/LogOn?returnUrl=%2F"); var document = new HtmlDocument(); document.LoadHtml(content); return(document); }
private void PostDelete(WebClientWithCookies client) { var node = this.GetDeleteDocument(client).DocumentNode .SelectNodes("//input[@name='__RequestVerificationToken']").Single(); var formValues = new List<string> { "__RequestVerificationToken=" + node.Attributes["Value"].Value, "Listed=false" }; client.UploadString(this.GetPackageUrl(), string.Join("&", formValues.ToArray())); }
private void PostDelete(WebClientWithCookies client) { var node = this.GetDeleteDocument(client).DocumentNode .SelectNodes("//input[@name='__RequestVerificationToken']").Single(); var formValues = new List <string> { "__RequestVerificationToken=" + node.Attributes["Value"].Value, "Listed=false" }; client.UploadString(this.GetPackageUrl(), string.Join("&", formValues.ToArray())); }
private void PostSignIn(WebClientWithCookies client) { var node = GetLogOnDocument(client).DocumentNode .SelectNodes("//input[@name='__RequestVerificationToken']")[1]; var formValues = new List<string> { "__RequestVerificationToken=" + node.Attributes["Value"].Value, "ReturnUrl=/", "LinkingAccount=False", "SignIn.UserNameOrEmail=" + this.nugetPackageInfo.UserId, "SignIn.Password="******"https://www.nuget.org/users/account/SignIn", string.Join("&", formValues.ToArray())); }
private void PostSignIn(WebClientWithCookies client) { var node = GetLogOnDocument(client).DocumentNode .SelectNodes("//input[@name='__RequestVerificationToken']")[1]; var formValues = new List <string> { "__RequestVerificationToken=" + node.Attributes["Value"].Value, "ReturnUrl=/", "LinkingAccount=False", "SignIn.UserNameOrEmail=" + this.nugetPackageInfo.UserId, "SignIn.Password="******"https://www.nuget.org/users/account/SignIn", string.Join("&", formValues.ToArray())); }