Пример #1
0
        /// <summary>
        /// Validate cstring visit.
        /// </summary>
        /// <param name="item"></param>
        public void Visit(CStringDataItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            AB_RootDataTag tag = RetrieveTag(item);

            Assert.AreEqual(tag.Value, "\"" + item.Value + "\"");
        }
Пример #2
0
        /// <summary>
        /// Visit cstring item.
        /// </summary>
        /// <param name="item"></param>
        public void Visit(CStringDataItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            //
            // Last byte is a null character.
            //

            byte[] values = GetItemValue(item);
            values = values.Take(values.Length - 1).ToArray();

            var chars = new char[values.Length];

            for (int i = 0; i < chars.Length; i++)
            {
                chars[i] = (char)values[i];
            }
            item.Value = new string(chars);
            Context.DataItems.Add(item);
        }