public void Check(MessageSerializedPropertyInfo messageSerializedPropertyInfo, SerializationDefaults serializationDefaults, MessageClassAttribute classAttribute) { if (!messageSerializedPropertyInfo.ContainsAuthenticationAttribute && messageSerializedPropertyInfo.PropertyInfo.Name.Equals("Hash", StringComparison.InvariantCultureIgnoreCase)) { messageSerializedPropertyInfo.CalculatedFieldAttributes.Add(new CalculatedAuthenticationResultAttribute(typeof(CalculatorAuthenticationSha256))); // Since we know the result of the hash is going to be 32 bytes if the Length property hasn't been set we'll set it. if (!messageSerializedPropertyInfo.MessagePropertyAttribute.IsLengthSpecified) { messageSerializedPropertyInfo.MessagePropertyAttribute.Length = 32; } } }
public void Check(MessageSerializedPropertyInfo messageSerializedPropertyInfo, SerializationDefaults serializationDefaults, MessageClassAttribute classAttribute) { if (!messageSerializedPropertyInfo.ContainsLengthAttribute && messageSerializedPropertyInfo.PropertyInfo.Name == "Length") { messageSerializedPropertyInfo.CalculatedFieldAttributes.Add(new CalculatedLengthResultAttribute()); } }
public void Check(MessageSerializedPropertyInfo messageSerializedPropertyInfo, SerializationDefaults serializationDefaults, MessageClassAttribute classAttribute) { if (!messageSerializedPropertyInfo.CalculatedFieldAttributes.Any(item => item is CalculatedChecksum5555ResultAttribute || item is CalculatedChecksum5555Attribute)) { if (messageSerializedPropertyInfo.PropertyInfo.Name == "Checksum") { messageSerializedPropertyInfo.CalculatedFieldAttributes.Add(new CalculatedChecksum5555ResultAttribute()); } if (messageSerializedPropertyInfo.PropertyInfo.Name == "NumberNotIncludedInChecksum") { CalculatedChecksum5555Attribute attribute = new CalculatedChecksum5555Attribute(); attribute.Exclude = true; messageSerializedPropertyInfo.CalculatedFieldAttributes.Add(attribute); } } }
void VerifyMessageSerializedClassAttribute(MessageClassAttribute classInfoToVerify, MessageClassAttribute classInfoExpected, string infoPrefix) { Assert.That(classInfoToVerify.DefaultExcludeProperty, Is.EqualTo(classInfoExpected.DefaultExcludeProperty), infoPrefix + "::DefaultExcludeProperty"); Assert.That(classInfoToVerify.PutInheritedPropertiesLast, Is.EqualTo(classInfoExpected.PutInheritedPropertiesLast), infoPrefix + "::PutInheritedPropertiesLast"); }
public void Check(MessageSerializedPropertyInfo messageSerializedPropertyInfo, SerializationDefaults serializationDefaults, MessageClassAttribute classAttribute) { if (!messageSerializedPropertyInfo.MessagePropertyAttribute.IsPrepadCharacterSpecified) { messageSerializedPropertyInfo.MessagePropertyAttribute.PrepadCharacter = '0'; } }
public void Check(MessageSerializedPropertyInfo messageSerializedPropertyInfo, SerializationDefaults serializationDefaults, MessageClassAttribute classAttribute) { var messagePropertyAttribute = messageSerializedPropertyInfo.MessagePropertyAttribute; if (!messagePropertyAttribute.IsEndiannessSpecified) { if (classAttribute.EndiannessExplicitlySpecified) { messagePropertyAttribute.Endianness = classAttribute.Endianness; } else if (serializationDefaults != null) { messagePropertyAttribute.Endianness = serializationDefaults.Endianness; } else { messagePropertyAttribute.Endianness = Endiannesses.System; } } }