Beispiel #1
0
 public S3FileStorage(string bucketName, string accessKey, string secretKey, IStoredNameProvider <T> nameProvider)
 {
     _bucketName   = bucketName;
     _accessKey    = accessKey;
     _secretKey    = secretKey;
     _nameProvider = nameProvider;
 }
        public LocalFileStorage(Uri baseUri, IStoredNameProvider <T> nameProvider, string storeFolder = null)
        {
            this.baseUri      = baseUri;
            this.nameProvider = nameProvider;
            baseFolder        = Path.GetTempPath();
            if (!string.IsNullOrEmpty(storeFolder))
            {
                try
                {
                    if (!Directory.Exists(storeFolder))
                    {
                        Directory.CreateDirectory(storeFolder);
                    }

                    baseFolder = storeFolder;
                    Log.Info("Storage folder is configured successfully");
                }
                catch (Exception)
                {
                    Log.ErrorFormat(
                        "Configuration error. StorageFolder {0} is unaccesable, temporary folder {1} will be used instead",
                        storeFolder, baseFolder);
                }
            }
        }
 public AzureFileStorage(string connectionString, string containerName, IStoredNameProvider <T> nameProvider)
 {
     this.containerName = containerName;
     this.nameProvider  = nameProvider;
     //// sec * min * hour
     cacheControl          = $"max-age={60 * 60 * 24}, must-revalidate";
     this.connectionString = connectionString;
     try
     {
         InitStorage();
     }
     catch (Exception e)
     {
         Trace.TraceError("Init failed {0}: {1}", e.GetType().Name, e.Message);
     }
 }