Exemple #1
0
        public override string ToString()
        {
            string result = "";

            for (int row = 0; row < Info.Sizes.MSG_MAX_STRINGS_COUNT; row++)
            {
                byte[] btF   = new byte[Info.Sizes.MSG_MAX_STRING_LENGTH];
                int    from  = row * Info.Sizes.MSG_MAX_STRING_LENGTH;
                int    until = (row + 1) * Info.Sizes.MSG_MAX_STRING_LENGTH;

                /*int empStart = -1;
                 * //Вычисялем заполнен ли конец пробелами чтобы заменить переходом на новую строку
                 * for (int i = from; i < until; i++)
                 * {
                 *  if (_msg[i] == 0x20 ||_msg[i]==0)
                 *      empStart = i;
                 *  else empStart = -1;
                 * }
                 * if (empStart != -1)
                 *  btF = _msg.Skip(from).Take(empStart - from).ToArray();
                 * else*/
                //btF = _msg.Skip(from).Take(Info.Sizes.MSG_MAX_STRING_LENGTH).ToArray();
                Array.Copy(_msg, from, btF, 0, Info.Sizes.MSG_MAX_STRING_LENGTH);
                if (!BitHelper.ArrayIsEmpty(btF))
                {
                    if (row != 0)
                    {
                        result += Environment.NewLine;
                    }
                    result += Encoding.GetEncoding(866).GetString(btF).TrimEnd(new char[] { ' ' }).Replace("\0", "");
                }
            }
            return(result);
            //return result.Remove(result.LastIndexOf(Environment.NewLine));
        }