Group.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Text;
  3. namespace FastReport.Export.Dxf.Groups
  4. {
  5. public class Group<T> : GroupBase
  6. {
  7. #region Private Fields
  8. private T value;
  9. #endregion Private Fields
  10. #region Public Properties
  11. public virtual T Value
  12. {
  13. get { return value; }
  14. set { this.value = value; }
  15. }
  16. #endregion Public Properties
  17. #region Public Constructors
  18. public Group(int code, T value)
  19. {
  20. Code = code;
  21. Value = value;
  22. }
  23. #endregion Public Constructors
  24. #region Public Methods
  25. public override void AppendTo(StringBuilder s)
  26. {
  27. s.Append(Convert.ToString(Code)).Append("\n").Append(Convert.ToString(Value));
  28. }
  29. public override bool IsEndSectionGroup()
  30. {
  31. if (Code == 0 && (Value.GetType() == typeof(string) && (Value as string) == "ENDSEC"))
  32. return true;
  33. else
  34. return false;
  35. }
  36. #endregion Public Methods
  37. }
  38. public abstract class GroupBase
  39. {
  40. #region Private Fields
  41. private int code;
  42. #endregion Private Fields
  43. #region Public Properties
  44. public virtual int Code
  45. {
  46. get { return code; }
  47. set { code = value; }
  48. }
  49. #endregion Public Properties
  50. #region Public Methods
  51. public abstract void AppendTo(StringBuilder s);
  52. public abstract bool IsEndSectionGroup();
  53. #endregion Public Methods
  54. }
  55. }