Exemplo n.º 1
0
        public static void HttpDownloadFile(
            string uri,
            string path,
            Configure <WebClient> configurator = null,
            Action <WebHeaderCollection> headerConfigurator = null)
        {
            var webClient = new WebClient();

            webClient = configurator.InvokeSafe(webClient);
            headerConfigurator?.Invoke(webClient.Headers);

            FileSystemTasks.EnsureExistingParentDirectory(path);

            webClient.DownloadFile(new Uri(uri), path);
        }
Exemplo n.º 2
0
 public static void WriteAllBytes(string path, byte[] bytes)
 {
     FileSystemTasks.EnsureExistingParentDirectory(path);
     File.WriteAllBytes(path, bytes);
 }
Exemplo n.º 3
0
 public static void WriteAllText(string path, string content, Encoding encoding = null)
 {
     FileSystemTasks.EnsureExistingParentDirectory(path);
     File.WriteAllText(path, content, encoding ?? UTF8NoBom);
 }