SuffixHelper.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. /// <summary>
  6. /// 后缀帮助类
  7. /// </summary>
  8. public class SuffixHelper
  9. {
  10. #region Excel后缀管理
  11. /// <summary>
  12. /// Excel后缀枚举
  13. /// </summary>
  14. public enum ExcelSuffix
  15. {
  16. /// <summary>
  17. /// 新版后缀
  18. /// </summary>
  19. S2007,
  20. /// <summary>
  21. /// 老版后缀
  22. /// </summary>
  23. S2003,
  24. }
  25. /// <summary>
  26. /// 获取Excel文件后缀
  27. /// </summary>
  28. /// <param name="_suffix"></param>
  29. /// <returns></returns>
  30. public static string GetExcelSuffixInfo(ExcelSuffix _suffix)
  31. {
  32. return _suffix == ExcelSuffix.S2003 ? ".xls" : ".xlsx";
  33. }
  34. #endregion
  35. #region 图片后缀管理
  36. /// <summary>
  37. /// 图片后缀枚举
  38. /// </summary>
  39. public enum PictureSuffix
  40. {
  41. PNG,
  42. png,
  43. JPG,
  44. jpg,
  45. jpeg
  46. }
  47. /// <summary>
  48. /// 获取图片后缀
  49. /// </summary>
  50. /// <param name="_suffix"></param>
  51. /// <returns></returns>
  52. public static string GetPictureSuffixInfo(PictureSuffix _suffix)
  53. {
  54. string resultSuffix = String.Empty;
  55. switch (_suffix)
  56. {
  57. case PictureSuffix.PNG:
  58. resultSuffix = ".PNG";
  59. break;
  60. case PictureSuffix.png:
  61. resultSuffix = ".png";
  62. break;
  63. case PictureSuffix.JPG:
  64. resultSuffix = ".JPG";
  65. break;
  66. case PictureSuffix.jpg:
  67. resultSuffix = ".jpg";
  68. break;
  69. case PictureSuffix.jpeg:
  70. resultSuffix = ".jpeg";
  71. break;
  72. }
  73. return resultSuffix;
  74. }
  75. #endregion
  76. }