AttributeBase.cs 1.8 KB

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