BTool.DeviceFormUtils.UnloadDeviceAddr C# (CSharp) Method

UnloadDeviceAddr() public method

public UnloadDeviceAddr ( byte data, byte &addr, int &index, bool direction, bool &dataErr ) : string
data byte
addr byte
index int
direction bool
dataErr bool
return string
        public string UnloadDeviceAddr(byte[] data, ref byte[] addr, ref int index, bool direction, ref bool dataErr)
        {
            string address = string.Empty;
            byte bits = 0;
            dataErr = false;
            try
            {
                for (int index1 = 0; index1 < 6; ++index1)
                {
                    m_dataUtils.Unload8Bits(data, ref index, ref bits, ref dataErr);
                    if (dataErr)
                        break;

                    addr[index1] = bits;
                    address = !direction
                        ? (index1 == 0 ? string.Format("{0:X2}", bits) + address : string.Format("{0:X2}:", bits) + address)
                        : (index1 == 5 ? address + string.Format("{0:X2}", bits) : address + string.Format("{0:X2}:", bits));
                }
            }
            catch (Exception ex)
            {
                m_msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("Unload Device Address Failed\nMessage Data Transfer Issue.\n\n{0}\n", ex.Message));
                dataErr = true;
            }
            return address;
        }