PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/Models/S3StorageFile.cs

#
C# | 65 lines | 54 code | 10 blank | 1 comment | 0 complexity | c9c5b3b1f15ab1ab12df2a4f6030ffd2 MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Web;
 5using Orchard.FileSystems.Media;
 6using Amazon.S3.Model;
 7using System.Collections.Specialized;
 8using System.IO;
 9using Amazon.S3;
10
11namespace Werul.S3StorageProvider.Models
12{
13    internal class S3StorageFile : IStorageFile
14    {
15        private readonly S3Object _entry;
16        private readonly string _contentType;
17
18        public S3StorageFile(S3Object entry, string contentType)
19        {
20            // TODO: Complete member initialization
21            this._entry = entry;
22            this._contentType = contentType;
23        }
24
25        public string GetPath()
26        {
27            return _entry.Key;
28        }
29
30        public string GetName()
31        {
32            return _entry.Key.Substring(_entry.Key.LastIndexOf("/") + 1);
33        }
34
35        public long GetSize()
36        {
37            return _entry.Size;
38        }
39
40        public DateTime GetLastUpdated()
41        {
42            return DateTime.Parse(_entry.LastModified);
43        }
44
45        public string GetFileType()
46        {
47            return _contentType;
48        }
49
50        public System.IO.Stream OpenRead()
51        {
52            throw new NotImplementedException();
53        }
54
55        public System.IO.Stream OpenWrite()
56        {
57            throw new NotImplementedException();
58        }
59
60        public System.IO.Stream CreateFile()
61        {
62            throw new NotImplementedException();
63        }
64    }
65}