資源簡介
簡潔明了,可以為相關(guān)人員提供一個(gè)解析文件的思路,沒有復(fù)雜的代碼,比較容易理解
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Text.Regularexpressions;
using?TPCANHandle?=?System.Byte;
using?System.IO;
using?System.Threading;
using?System.Collections;
namespace?WindowsFormsApplication1
{
????public?partial?class?Form1?:?Form
????{
????????private?class?MessageStatus
????????{
????????????private?TPCANMsg?m_Msg;
????????????private?TPCANTimestamp?m_TimeStamp;
????????????private?int?m_index;
????????????public?MessageStatus(TPCANMsg?canMsg?TPCANTimestamp?canTimeStamp?int?listindex)
????????????{
????????????????m_Msg?=?canMsg;
????????????????m_TimeStamp?=?canTimeStamp;
????????????????m_index?=?listindex;
????????????}
????????????public?TPCANMsg?CANMsg
????????????{
????????????????get?{?return?CANMsg;?}
????????????}
????????????public?TPCANTimestamp?TimeStamp
????????????{
????????????????get?{?return?m_TimeStamp;?}
????????????}
????????????public?string?TypeString
????????????{
????????????????get?{?return?GetMsgTypeString();?}
????????????}
????????????public?string?IdString
????????????{
????????????????get?{?return?GetIdString();?}
????????????}
????????????public?string?DataString
????????????{
????????????????get?{?return?GetDataString();?}
????????????}
????????????private?string?GetDataString()
????????????{
????????????????string?strTemp;
????????????????strTemp?=?““;
????????????????if?((m_Msg.MSGTYPE?&?TPCANMessageType.PCAN_MESSAGE_RTR)?==?TPCANMessageType.PCAN_MESSAGE_RTR)
????????????????????return?“Remote?Request“;
????????????????else
????????????????????for?(int?i?=?0;?i?????????????????????????strTemp?+=?string.Format(“{0:X2}?“?m_Msg.DATA[i]);
????????????????return?strTemp;
????????????}
????????????private?string?GetMsgTypeString()
????????????{
????????????????string?strTemp;
????????????????if?((m_Msg.MSGTYPE?&?TPCANMessageType.PCAN_MESSAGE_EXTENDED)?==?TPCANMessageType.PCAN_MESSAGE_EXTENDED)
????????????????????strTemp?=?“EXTENDED“;
????????????????else
????????????????????strTemp?=?“STANDARD“;
????????????????if?((m_Msg.MSGTYPE?&?TPCANMessageType.PCAN_MESSAGE_RTR)?==?TPCANMessageType.PCAN_MESSAGE_RTR)
????????????????????strTemp?+=?“/RTR“;
????????????????return?strTemp;
????????????}
????????????private?string?GetIdString()
????????????{
????????????????//?We?format?the?ID?of?the?message?and?show?it
????????????????//
????????????????if?((m_Msg.MSGTYPE?&?TPCANMessageType.PCAN_MESSAGE_EXTENDED)?==?TPCANMessageType.PCAN_MESSAGE_EXTENDED)
????????????????????return?string.Format(“{0:X8}h“?m_Msg.ID);
????????????????else
????????????????????return?string.Format(“{0:X3}h“?m_Msg.ID);
????????????}
????????}
????????public?TPCANHandle?m_PcanHandle;
????????public?TPCANBaudrate?m_Baudrate;
????????public?TPCANType?m_HwType;
????????public?b
評論
共有 條評論