Example #1
0
        internal DecimalValue(DataReader r, int count, Item[] items)
        {
            if (count == 0)
            {
                _valueStore = new ValueDictionaryOf <decimal>(count, default);
            }
            else
            {
                var str = ReadString(r);
                var val = decimal.Parse(str);

                var vs = new ValueDictionaryOf <decimal>(count, val);
                _valueStore = vs;

                for (int i = 0; i < count; i++)
                {
                    var inx = r.ReadInt32();
                    if (inx < 0 || inx >= items.Length)
                    {
                        throw new Exception($"Invalid row index {inx}");
                    }

                    var rx = items[inx];
                    if (rx == null)
                    {
                        throw new Exception($"Column row is null, index {inx}");
                    }

                    str = ReadString(r);
                    val = decimal.Parse(str);

                    vs.LoadValue(rx, val);
                }
            }
        }
Example #2
0
        internal UInt16Value(DataReader r, int count, Item[] items)
        {
            if (count == 0)
            {
                _valueStore = new ValueDictionaryOf <ushort>(count, default);
            }
            else
            {
                var vs = new ValueDictionaryOf <ushort>(count, r.ReadUInt16());
                _valueStore = vs;

                for (int i = 0; i < count; i++)
                {
                    var inx = r.ReadInt32();
                    if (inx < 0 || inx >= items.Length)
                    {
                        throw new Exception($"Invalid row index {inx}");
                    }

                    var rx = items[inx];
                    if (rx == null)
                    {
                        throw new Exception($"Column row is null, index {inx}");
                    }

                    vs.LoadValue(rx, r.ReadUInt16());
                }
            }
        }
Example #3
0
        internal SByteArrayValue(DataReader r, int count, Item[] items)
        {
            var vs = new ValueDictionaryOf <sbyte[]>(count, null);

            _valueStore = vs;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    var inx = r.ReadInt32();
                    if (inx < 0 || inx >= items.Length)
                    {
                        throw new Exception($"Invalid row index {inx}");
                    }

                    var rx = items[inx];
                    if (rx == null)
                    {
                        throw new Exception($"Column row is null, index {inx}");
                    }

                    var len = r.ReadUInt16();

                    var val = new sbyte[len];
                    if (len > 0)
                    {
                        for (int j = 0; j < len; j++)
                        {
                            val[j] = (sbyte)r.ReadByte();
                        }
                    }
                    vs.LoadValue(rx, val);
                }
            }
        }