FileConfig.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public enum RoomFileType
  5. {
  6. png,
  7. jpg,
  8. jpeg,
  9. mp4,
  10. zip,
  11. pdf,
  12. unknown
  13. }
  14. public class FileConfig
  15. {
  16. private string peerId;
  17. private string from;
  18. private string createTime;
  19. private string url;
  20. private string path;
  21. private string fileName;
  22. public string PeerId { get => peerId; set => peerId = value; }
  23. public string From { get => from; set => from = value; }
  24. public string CreateTime { get => createTime; set => createTime = value; }
  25. public string Url { get => url; set => url = value; }
  26. public string Path { get => path; set => path = value; }
  27. public string FileName { get => fileName; set => fileName = value; }
  28. public RoomFileType FileType
  29. {
  30. get
  31. {
  32. if (!string.IsNullOrEmpty(this.FileName))
  33. {
  34. string[] str = this.FileName.Split('.');
  35. switch (str[str.Length-1])
  36. {
  37. case "png":
  38. return RoomFileType.png;
  39. case "jpg":
  40. return RoomFileType.jpg;
  41. case "jpeg":
  42. return RoomFileType.jpeg;
  43. case "mp4":
  44. return RoomFileType.mp4;
  45. case "zip":
  46. return RoomFileType.zip;
  47. case "pdf":
  48. return RoomFileType.pdf;
  49. }
  50. }
  51. return RoomFileType.unknown;
  52. }
  53. }
  54. }