using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication5 { class Program { static string CreateImage(byte r, byte g, byte b) { Bitmap bmp = new Bitmap(10, 10); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { bmp.SetPixel(i, j, Color.FromArgb(r, g, b)); } } string path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".png"); bmp.Save(path); return path; } static IEnumerable CreateImages(int count) { return Enumerable.Range(0, count).Select(n => CreateImage((byte)((double)n / count * 255), 0, 0)); } static void Copy() { var src = new CloudBlobContainer(new Uri(@"https://dnyczstorage.blob.core.windows.net/zdjecia?sv=2017-04-17&ss=b&srt=sco&sp=rwdlac&se=2018-01-15T22:00:34Z&st=2018-01-13T14:00:34Z&spr=https&sig=LmSs8HO3VyOxejkAXL2E8nx8sfYgiMbLCQ4dhhOY1SU%3D")); var dst = new CloudBlobContainer(new Uri(@"https://myfuckingstorage.blob.core.windows.net/copy?sv=2017-04-17&ss=bfqt&srt=sco&sp=rwdlacup&se=2018-01-14T21:43:10Z&st=2018-01-13T10:43:10Z&spr=https&sig=l8fHWJT10CySa%2Fqzbz%2B4AFcgW%2FURAlhuNeQJ%2BIvzfWg%3D")); foreach (var i in src.ListBlobs()) { var bbr = dst.GetBlockBlobReference(Path.GetFileName(i.Uri.ToString())); bbr.StartCopy(i.Uri); Console.WriteLine(i.Uri); } } private static void Upload() { var csa = CloudStorageAccount.Parse(@"DefaultEndpointsProtocol=https;AccountName=myfuckingstorage;AccountKey=uNmgCLfBpfriY3JRnk8P4krQuV1Tp27JdPmou4cUIHLArKf9k7ON8lYfCQHihqJDKrm78GfSTwL+bqEFgQmlGw==;EndpointSuffix=core.windows.net"); var ccbc = csa.CreateCloudBlobClient(); var zdjecia = ccbc.GetContainerReference("zdjecia"); var images = CreateImages(5); foreach (var image in images) { var b = zdjecia.GetBlockBlobReference(Path.GetFileName(image)); b.UploadFromFile(image); Console.WriteLine(image); } } static void Main(string[] args) { Copy(); //Upload(); } } }