The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UploadConfig.cs 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Web;
  6. namespace Teknik.Configuration
  7. {
  8. public class UploadConfig
  9. {
  10. public bool UploadEnabled { get; set; }
  11. public bool DownloadEnabled { get; set; }
  12. // Max upload size in bytes
  13. public long MaxUploadSize { get; set; }
  14. // Max Upload Size for basic users
  15. public long MaxUploadSizeBasic { get; set; }
  16. // Max Upload Size for premium users
  17. public long MaxUploadSizePremium { get; set; }
  18. // Gets the maximum download size before they are forced to the download page
  19. public long MaxDownloadSize { get; set; }
  20. // Location of the upload directory
  21. public string UploadDirectory { get; set; }
  22. // File Extension for saved files
  23. public string FileExtension { get; set; }
  24. public int UrlLength { get; set; }
  25. public int DeleteKeyLength { get; set; }
  26. public int KeySize { get; set; }
  27. public int BlockSize { get; set; }
  28. public bool IncludeExtension { get; set; }
  29. // The size of the chunk that the file will be encrypted/decrypted in (bytes)
  30. public int ChunkSize { get; set; }
  31. // Virus Scanning Settings
  32. public bool VirusScanEnable { get; set; }
  33. public string ClamServer { get; set; }
  34. public int ClamPort { get; set; }
  35. // Content Type Restrictions
  36. public List<string> RestrictedContentTypes { get; set; }
  37. public List<string> RestrictedExtensions { get; set; }
  38. public UploadConfig()
  39. {
  40. SetDefaults();
  41. }
  42. public void SetDefaults()
  43. {
  44. UploadEnabled = true;
  45. DownloadEnabled = true;
  46. MaxUploadSize = 100000000;
  47. MaxUploadSizeBasic = 100000000;
  48. MaxUploadSizePremium = 100000000;
  49. MaxDownloadSize = 100000000;
  50. UploadDirectory = Directory.GetCurrentDirectory();
  51. FileExtension = "enc";
  52. UrlLength = 5;
  53. DeleteKeyLength = 24;
  54. KeySize = 256;
  55. BlockSize = 128;
  56. IncludeExtension = true;
  57. ChunkSize = 1024;
  58. VirusScanEnable = false;
  59. ClamServer = "localhost";
  60. ClamPort = 3310;
  61. RestrictedContentTypes = new List<string>();
  62. RestrictedExtensions = new List<string>();
  63. }
  64. }
  65. }