Skip to content

Instantly share code, notes, and snippets.

Created May 13, 2013 13:30
Show Gist options
  • Save anonymous/5568302 to your computer and use it in GitHub Desktop.
Save anonymous/5568302 to your computer and use it in GitHub Desktop.
public interface IStorage
{
Uri Save(Stream data, string name);
Task<Stream> LoadAsync(Uri dataUri);
}
public static class Storage
{
public static bool SaveDownloadedFile(WebResponse response, ref string fileName)
{
using (var stream = response.GetResponseStream())
{
if (stream == null)
return false;
using (var file = File.Create(fileName))
{
fileName = file.Name;
stream.CopyTo(file);
file.Close();
}
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment