AttributeBase.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Edge.Core.Parser.BinaryParser.Attributes
  7. {
  8. public class AttributeBase : Attribute
  9. {
  10. /// <summary>
  11. /// The index value which mapping to the field appearence in raw bytes, based on 0
  12. /// </summary>
  13. public int Index { get; protected set; }
  14. /// <summary>
  15. /// encoding type.
  16. /// </summary>
  17. public EncodingType EncodingType { get; set; }
  18. /// <summary>
  19. /// If a var length field, then set the linked property name
  20. /// </summary>
  21. public string LengthOrCountLink { get; protected set; }
  22. /// <summary>
  23. /// If a fixed length field, then set the length value. otherwise, leave it.
  24. /// </summary>
  25. public int FixedLengthOrCount { get; protected set; }
  26. /// <summary>
  27. /// a message typically have a field to input the total length.
  28. /// </summary>
  29. //public bool IsMessageLengthField { get; set; }
  30. /// <summary>
  31. /// a field was turned on or off by another field with specific value
  32. /// Tuple<Tuple<string, byte[]>, int> means field 'string' control the appearance, if field 'string' equals 'byte[]', then
  33. /// the current field length is 'int'
  34. /// </summary>
  35. //public Tuple<Tuple<string, byte[]>, int> SwitcherLink { get; set; }
  36. /// <summary>
  37. /// all hex based: 00:04; means value 00 in LengthLink field mapping to length current field length 4.
  38. /// 0102:05; means values of 2 bytes 01 and 02 in LengthLink field mapping to current field length 5.
  39. /// can setup a group of expression, like: 00:04;0102:05;03:0801;
  40. /// MUST END WITH-> ;
  41. /// </summary>
  42. public string LengthOrCountLinkExpression { get; protected set; }
  43. }
  44. }