Example #1
0
        ///////////////////////////////////////////////////////////////////////

        public static ByteList FromString(
            string value,
            ref Result error
            )
        {
            StringList list = null;

            if (Parser.SplitList(
                    null, value, 0, Length.Invalid, true,
                    ref list, ref error) == ReturnCode.Ok)
            {
                ByteList list2 = new ByteList(list.Count);

                foreach (string element in list)
                {
                    byte byteValue = 0;

                    if (Value.GetByte2(element, ValueFlags.AnyByte, null,
                                       ref byteValue, ref error) != ReturnCode.Ok)
                    {
                        return(null);
                    }

                    list2.Add(byteValue);
                }

                return(list2);
            }

            return(null);
        }
Example #2
0
        ///////////////////////////////////////////////////////////////////////

        public bool AddFromString(
            string value,
            ref Result error
            )
        {
            ByteList list = FromString(value, ref error);

            if (list == null)
            {
                return(false);
            }

            this.AddRange(list);
            return(true);
        }