Пример #1
0
        static void TestGetConfig()
        {
            BlobStorageConfig config = BlobStorageConfig.GetConfig("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/config.json");

            Console.WriteLine(config.StorageConnectionStringFile);
            Console.WriteLine(config.StorageConnectionString);
        }
Пример #2
0
        static void TestUploadBlob()
        {
            BlobStorageConfig config      = BlobStorageConfig.GetConfig("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/config.json");
            BlobStorage       blobStorage = new BlobStorage(config);
            FileStream        fs          = new FileStream("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/Resource/testpic/github-octocat.png", FileMode.Open);

            Task <Uri> t = blobStorage.UploadAsync(fs, "abc.png");

            t.Wait();
            Console.WriteLine(t.Result);
        }
Пример #3
0
        static async void TestUploadBinaryAsync()
        {
            BlobStorageConfig config         = BlobStorageConfig.GetConfig("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/config.json");
            BlobStorage       blobStorage    = new BlobStorage(config);
            ImageProcessor    imageProcessor = new ImageProcessor();
            ImageDBManager    imageDBManager = new ImageDBManager(new MediaRecordDatabaseContext());

            ImageService imageService = new ImageService(config, imageProcessor, blobStorage, imageDBManager);

            FileStream fs = new FileStream("C:/Users/t-chwang/source/repos/ImageServingPlatform/Core/Resource/testpic/github-octocat.png", FileMode.Open);

            byte[] fileContent = new BinaryReader(fs).ReadBytes((int)fs.Length);
            Console.WriteLine(fileContent.Length);
            fs.Close();

            await imageService.UploadBinaryAsync(fileContent, "abc.png");

            Console.WriteLine("End of TestUploadBinaryAsync. ");
        }