Example #1
0
        private T2K T2KRead()
        {
            var answer = new byte[2048];

            for (int i = 0; i < 32; i++)
            {
                var curAddr   = i * 0x40;
                var curanswer = SendRequest(0x0f01, new byte[] { ConvertHelper.ByteHigh(curAddr), ConvertHelper.ByteLow(curAddr), 0x40 });

                if (curanswer == null || curanswer.Length != 65)
                {
                    Show("не удалось прочесть память таймера 2к");
                    return(null);
                }
                Array.Copy(curanswer, 1, answer, 64 * i, 64);
            }
            return(T2K.Parse(answer, 0));
        }
Example #2
0
        public static T2K Parse(byte[] data, int offset)
        {
            if (data == null || data.Length < 0x2FF + offset)
            {
                return(null);
            }

            var result = new T2K();

            result.Systems = data[offset + 0];
            for (int i = 0; i < 12; i++)
            {
                result.Type_g[i] = (TypeG)data[offset + 0x01 + i];
                result.Type_t[i] = (TypeT)data[offset + 0x0c + i];
            }
            result.Net_num = BitConverter.ToInt32(ConvertHelper.GetReversed(data, offset + 0x78, 4), 0);
            result.Number  = BitConverter.ToInt32(ConvertHelper.GetReversed(data, offset + 0x7c, 4), 0);

            for (int i = 0; i < 4; i++)
            {
                result.Diam[i]       = BitConverter.ToInt16(ConvertHelper.GetReversed(data, offset + 0xc4 + i * 2, 2), 0);
                result.G_max[i]      = BitConverter.ToSingle(ConvertHelper.GetReversed(data, offset + 0xcc + i * 4, 4), 0);
                result.G_pcnt_max[i] = data[offset + 0xdc + i];
                result.G_pcnt_min[i] = data[offset + 0xe0 + i];
            }

            for (int i = 0; i < 2; i++)
            {
                result.F_max[i]  = BitConverter.ToSingle(ConvertHelper.GetReversed(data, offset + 0xe4 + i * 4, 4), 0);
                result.Weight[i] = BitConverter.ToSingle(ConvertHelper.GetReversed(data, offset + 0xec + i * 4, 4), 0);//??? 74? EC?
            }

            result.SysInt_copy = SysInt.Parse(data, offset + 0x200);
            for (int i = 0; i < 4; i++)
            {
                result.SysConN[i] = SysCon.Parse(data, offset + 0x600 + i * 0x20);
            }

            return(result);
        }