Created
April 9, 2019 08:06
-
-
Save leakedby/db74e493dba87ba430ec81b67f4fdf02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Leaf.xNet; | |
public static Bitmap XNetDownload(string url) | |
{ | |
try | |
{ | |
var request = new HttpRequest(); | |
request.UserAgentRandomize(); | |
var response = request.Get(url); | |
if (response.IsOK) | |
{ | |
var mem = response.ToMemoryStream(); | |
var image = new Bitmap(mem); | |
return image; | |
} | |
return null; | |
} | |
catch (Exception) | |
{ | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment