private void ParseType(IndividualEndianessBinaryReader br) { var infotype = br.ReadByte(); if (Enum.IsDefined(typeof(AdditionalInfoType), infotype)) { _infoType = (AdditionalInfoType)infotype; } else { throw BufferFieldException.TypeUnknown("AdditionalInfoType", infotype); } }
/// <summary> /// Create an <c>AdditionalInformationField</c> class from a type info and the actual info /// </summary> /// <param name="infoType"></param> /// <param name="info"></param> public AdditionalInformationField(AdditionalInfoType infoType, byte[] info) { if (info == null) { throw new ArgumentNullException("data parameter must not be null!"); } if (info.Length < 1) { throw new ArgumentException("Size of data array to small"); } _infoType = infoType; SetInfo(info); _size = 2 + _infoLength; }
private void VerifyLength(AdditionalInfoType type, int length) { if (type == AdditionalInfoType.RFFASTACK || type == AdditionalInfoType.MANUFACTURER) { // TODO: Add checking of correct length // requires some calcs } else { if (length != TypeSizes[type]) { throw BufferFieldException.WrongValue($"AdditionalInfo ({type}) length", TypeSizes[type], length); } } }
/* * //! Creates a default ui element with two buttons ... * public AdditionalInfo(string additionalInfoText, methode1, methode2 * { * this.type = AdditionalInfoType.CUSTOM; * this.additionalInfoText = additionalInfoText; * this.customUIElement = null; * }*/ //! Uses the custom ui element given in customUIElement. public AdditionalInfo(GameObject customUIElement) { this.type = AdditionalInfoType.CUSTOM; this.additionalInfoText = null; this.customUIElement = customUIElement; }
//private delegate yes; //private delegate no; //! Creates a default ui element above the notification with the text given in additionalInfoText public AdditionalInfo(string additionalInfoText) { this.type = AdditionalInfoType.TEXT; this.additionalInfoText = additionalInfoText; this.customUIElement = null; }