Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        static public byte[] Parse(TemperatureLine line)
        {
            ArgumentChecker.CheckNotNull(line);
            byte[] bs = new byte[_size * 2];
            for (int i = 0; i < _size; i++)
            {
                byte[] linePointDatas = TemperatureLinePoint.Parse(line[i]);
                int    idx            = i * 2;

                bs[idx]     = linePointDatas[0];
                bs[idx + 1] = linePointDatas[1];
            }
            return(bs);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="datas"></param>
        /// <param name="beginPos"></param>
        /// <returns></returns>
        static public TemperatureLine Parse(byte[] datas, int beginPos)
        {
            ArgumentChecker.CheckNotNull(datas);
            if (datas.Length < (_size * 2) + beginPos)
            {
                throw new ArgumentException("datas.length");
            }

            TemperatureLine tl = new TemperatureLine();

            for (int i = 0; i < _size; i++)
            {
                int    idx             = i * 2 + beginPos;
                byte[] pointDatas      = new byte[] { datas[idx], datas[idx + 1] };
                TemperatureLinePoint p = TemperatureLinePoint.Parse(pointDatas);
                tl[i] = p;
            }

            return(tl);
        }