Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hkucuk/a13ec8c9545da93b60ce080ac9ef6ea7 to your computer and use it in GitHub Desktop.
Save hkucuk/a13ec8c9545da93b60ce080ac9ef6ea7 to your computer and use it in GitHub Desktop.
class Program
{
private static T Deserialize(string objStr)
{
byte[] b = Convert.FromBase64String(objStr);
using (var stream = new MemoryStream(b))
{
var formatter = new BinaryFormatter();
stream.Seek(0, SeekOrigin.Begin);
return (T)formatter.Deserialize(stream);
}
}
static void Main(string[] args)
{
string strArg = args[0];
var arg = Deserialize(strArg);
for (int i = 0; i <= arg.UrlList.Count; i++)
{
var uri = new Uri(arg.UrlList[i]);
var localFileName = System.IO.Path.GetFileName(uri.LocalPath);
try
{
WebClient webClient = new WebClient();
webClient.DownloadFile(uri, localFileName);
Console.WriteLine(localFileName + "...ok");
}
catch (Exception ex)
{
Console.WriteLine(localFileName + "...err" + ex.Message);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment