Exemple #1
0
 /// <summary>
 /// Visit float item.
 /// </summary>
 /// <param name="item"></param>
 public void Visit(FloatDataItem item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     byte[] values = GetItemValue(item);
     item.Value =
         ParserHelper.ConvertSegmentsToArray(
             ParserHelper.SegmentArray(values, 4, true),
             (segment => BitConverter.ToSingle(segment, 0)));
     Context.DataItems.Add(item);
 }
Exemple #2
0
        /// <summary>
        /// Validate float visit.
        /// </summary>
        /// <param name="item"></param>
        public void Visit(FloatDataItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            AB_RootDataTag tag = RetrieveTag(item);

            //
            // Xml converter only stores 3 decimal places
            //

            ValidateAreEqual(GetData(tag.Value,
                                     value => (float)Math.Round(float.Parse(value, CultureInfo.InvariantCulture), 3)),
                             (from v in item.Value select(float) Math.Round(v, 3)).ToArray());
        }