PageRenderTime 52ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/Models/S3StorageFile.cs

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