예제 #1
0
        public string GetDataTag()
        {
            byte[] array = new byte[40960];
            int    num   = 0;
            int    num2  = StaticClassReaderB.ReadActiveModeData(array, ref num, this.frmcomportindex);
            bool   flag  = num2 == 0;
            string result;

            if (flag)
            {
                string text  = "";
                string text2 = this.ByteArrayToHexString(array);
                for (int i = 0; i < num; i++)
                {
                    text += text2.Substring(i * 2, 2);
                }
                bool flag2 = num > 0;
                if (flag2)
                {
                    result = text;
                }
                else
                {
                    result = "";
                }

                return("");
            }
            return("");
        }
예제 #2
0
        //7-3.读取主动模式数据
        private string getActiveModeData(byte fComAdr, int frmcomportindex)
        {
            byte[] data       = new byte[100];
            int    dataLength = 0;
            string temps      = "";

            fCmdRet = StaticClassReaderB.ReadActiveModeData(data, ref dataLength, frmcomportindex);

            int count = dataLength / 24;

            for (int i = 0; i < count; i++)
            {
                byte[] daw = new byte[19];
                Array.Copy(data, 7, daw, 0, 19);                //从data第7个字节开始复制到daw,复制19字节
                temps = ByteArrayToHexString(daw);              //7-5.字节转为十六进制
            }

            return(temps);
        }
예제 #3
0
        private void GetData()
        {
            byte[] ScanModeData = new byte[40960];
            int    ValidDatalength, i;
            string temp, temps;

            ValidDatalength = 0;
            fCmdRet         = StaticClassReaderB.ReadActiveModeData(ScanModeData, ref ValidDatalength, frmcomportindex);
            if (fCmdRet == 0)
            {
                temp  = "";
                temps = ByteArrayToHexString(ScanModeData);
                for (i = 0; i < ValidDatalength; i++)
                {
                    temp = temp + temps.Substring(i * 2, 2) + " ";
                }
                listBox3.Items.Add(temp + "\n\t");
                listBox3.SelectedIndex = listBox3.Items.Count - 1;
            }
            // AddCmdLog("Get", "获取", fCmdRet);
        }