GroupString.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. namespace FastReport.Export.Dxf.Groups
  3. {
  4. public class GroupString : Group<string>
  5. {
  6. #region Public Properties
  7. public override int Code
  8. {
  9. get { return base.Code; }
  10. set
  11. {
  12. if (value >= 0 || value <= 9)
  13. base.Code = value;
  14. else
  15. throw new Exception("Code must be in range 0 - 9, but have got: " + value);
  16. }
  17. }
  18. public override string Value
  19. {
  20. get { return base.Value; }
  21. set
  22. {
  23. if (value.Length > 255)
  24. throw new Exception("Value's length must be less then 255!, but have got: " + value.Length);
  25. else if (value.EndsWith("\r\n") || value.EndsWith("\n"))
  26. throw new Exception("Value must not include the newline at the end of the line!");
  27. else
  28. base.Value = value;
  29. }
  30. }
  31. #endregion Public Properties
  32. #region Public Constructors
  33. /// <summary>
  34. /// Code range: 0-9
  35. /// String (with the introduction of extended symbol names in AutoCAD 2000, the 255-character
  36. /// limit has been increased to 2049 single-byte characters not including the newline at the end
  37. /// of the line)
  38. /// </summary>
  39. public GroupString(int code, string value) : base(code, value)
  40. {
  41. }
  42. #endregion Public Constructors
  43. }
  44. }