Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions GeekLearning.Storage.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2DAF5EF9
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Integration.Test", "tests\GeekLearning.Integration.Test\GeekLearning.Integration.Test.xproj", "{590B21B0-2AFA-4329-82AD-EF180C50EB5C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6BEB33C6-FA17-4F58-ACC3-83C1EB28B604}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
LICENSE.md = LICENSE.md
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)
=====================

Copyright © `2016` `Geek Learning, Cyprien Autexier`
Copyright © `2016` `Geek Learning, Cyprien Autexier, Adrien Siffermann`

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![NuGet Version](http://img.shields.io/nuget/v/GeekLearning.Storage.svg?style=flat-square&label=nuget:%20primitives)](https://www.nuget.org/packages/GeekLearning.Storage/)
[![NuGet Version](http://img.shields.io/nuget/v/GeekLearning.Storage.FileSystem.svg?style=flat-square&label=nuget:%20filesystem)](https://www.nuget.org/packages/GeekLearning.Storage.FileSystem/)
[![NuGet Version](http://img.shields.io/nuget/v/GeekLearning.Storage.Azure.svg?style=flat-square&label=nuget:%20azure%20 storage)](https://www.nuget.org/packages/GeekLearning.Storage.Azure/)
[![Build Status](https://geeklearning.visualstudio.com/_apis/public/build/definitions/f841b266-7595-4d01-9ee1-4864cf65aa73/5/badge)](#)
[![Build Status](https://geeklearning.visualstudio.com/_apis/public/build/definitions/f841b266-7595-4d01-9ee1-4864cf65aa73/27/badge)](#)

# gl-dotnet-storage

Expand Down
187 changes: 0 additions & 187 deletions samples/GeekLearning.Storage.BasicSample/Project_Readme.html

This file was deleted.

10 changes: 3 additions & 7 deletions src/GeekLearning.Storage.Azure/AzureStorageManagerOptions.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace GeekLearning.Storage.Azure
namespace GeekLearning.Storage.Azure
{
using System.Collections.Generic;

public class AzureStorageManagerOptions
{

public Dictionary<string,SubStore> SubStores { get; set; }

public class SubStore
Expand Down
70 changes: 3 additions & 67 deletions src/GeekLearning.Storage.Azure/AzureStorageProvider.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
using GeekLearning.Storage;
using Microsoft.WindowsAzure.Storage;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace GeekLearning.Storage.Azure
namespace GeekLearning.Storage.Azure
{
using Storage;

public class AzureStorageProvider : IStorageProvider
{
private AzureStorageManagerOptions options;

public string Name
{
get
Expand All @@ -24,61 +16,5 @@ public IStore BuildStore(StorageOptions.StorageStore storeOptions)
{
return new AzureStore(storeOptions.Parameters["ConnectionString"], storeOptions.Parameters["Container"]);
}

//public AzureStorageProvider(IOptions<AzureStorageManagerOptions> options)
//{
// this.options = options.Value;
//}

//public async Task<string> StoreFile(byte[] data, string substore, string path, string mimeType)
//{
// var subStoreConfig = this.options.SubStores[substore];
// var account = CloudStorageAccount.Parse(subStoreConfig.ConnectionString);
// var blobClient = account.CreateCloudBlobClient();
// var container = blobClient.GetContainerReference(subStoreConfig.Container);
// return await SaveToStorage(container, data, path, mimeType);
//}

//private static async Task<string> SaveToStorage(Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, byte[] data, string path, string mimeType)
//{
// var blockBlob = container.GetBlockBlobReference(path);
// await blockBlob.UploadFromByteArrayAsync(data, 0, data.Length);
// blockBlob.Properties.ContentType = mimeType;
// blockBlob.Properties.CacheControl = "max-age=300, must-revalidate";
// await blockBlob.SetPropertiesAsync();
// return blockBlob.Uri.ToString();
//}

//public async Task<string> GetExpirableUri(string substore, string uri)
//{
// Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPolicy policy = new Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPolicy()
// {
// Permissions = Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions.Read,
// SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(5),
// };
// var subStoreConfig = this.options.SubStores[substore];
// var account = CloudStorageAccount.Parse(subStoreConfig.ConnectionString);
// var blobClient = account.CreateCloudBlobClient();
// var blobRef = await blobClient.GetBlobReferenceFromServerAsync(new Uri(uri));

// var sas = blobRef.GetSharedAccessSignature(policy);

// return uri + sas;
//}

//public Task<Stream> ReadFile()
//{
// throw new NotImplementedException();
//}

////private static async Task<string> SaveToStorage(Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, MemoryStream ms, string name)
////{
//// var blockBlob = container.GetBlockBlobReference(name);
//// await blockBlob.UploadFromStreamAsync(ms);
//// blockBlob.Properties.ContentType = "image/jpeg";
//// blockBlob.Properties.CacheControl = "max-age=300, must-revalidate";
//// await blockBlob.SetPropertiesAsync();
//// return blockBlob.Uri.ToString();
////}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using GeekLearning.Storage;
using GeekLearning.Storage.Azure;

namespace Microsoft.Extensions.DependencyInjection
namespace GeekLearning.Storage
{
using Azure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

public static class GeekLearningAzureStorageExtensions
{

Expand Down
22 changes: 14 additions & 8 deletions src/GeekLearning.Storage.Azure/project.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
{
"version": "0.0.1-*",
"version": "1.0.0-*",
"description": "GeekLearning.Storage.Azure Class Library",
"authors": [ "Geek Learning", "Cyprien Autexier", "Adrien Siffermann" ],
"packOptions": {
"tags": [ ],
"projectUrl": "",
"licenseUrl": ""
},
"frameworks": {
"net451": { },
"netstandard1.5": {
"imports": [ "dotnet", "dnxcore50", "portable-net45+win8" ]
}
},

"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc2-final",
"Microsoft.Extensions.Options": "1.0.0-rc2-final",
"NETStandard.Library": "1.5.0-rc2-24027",
"WindowsAzure.Storage": "7.0.1-preview",
"GeekLearning.Storage": "*"
},

"frameworks": {
"net451": { },
"netstandard1.5": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
}
}
13 changes: 4 additions & 9 deletions src/GeekLearning.Storage.FileSystem/FileSystemStorageProvider.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using GeekLearning.Storage;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;

namespace GeekLearning.Storage.FileSystem
namespace GeekLearning.Storage.FileSystem
{
using Storage;
using Microsoft.AspNetCore.Hosting;

public class FileSystemStorageProvider : IStorageProvider
{
private IHostingEnvironment appEnv;
Expand Down
Loading