ShortProperties.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace FastReport.Utils
  5. {
  6. internal static class ShortProperties
  7. {
  8. private static SortedList<string, string> FProps = new SortedList<string, string>();
  9. public static void Add(string shortName, string name)
  10. {
  11. if (!FProps.ContainsKey(shortName))
  12. FProps.Add(shortName, name);
  13. }
  14. public static string GetFullName(string name)
  15. {
  16. int i = FProps.IndexOfKey(name);
  17. return i == -1 ? name : FProps.Values[i];
  18. }
  19. public static string GetShortName(string name)
  20. {
  21. int i = FProps.IndexOfValue(name);
  22. if (i != -1)
  23. return FProps.Keys[i];
  24. else
  25. return name;
  26. }
  27. static ShortProperties()
  28. {
  29. Add("l", "Left");
  30. Add("t", "Top");
  31. Add("w", "Width");
  32. Add("h", "Height");
  33. Add("x", "Text");
  34. }
  35. }
  36. }