public void FfbFunction(IntPtr data) { unsafe { InternalFfbPacket *FfbData = (InternalFfbPacket *)data; int size = FfbData->DataSize; int command = (int)FfbData->Command; byte *bytes = (byte *)FfbData->PtrToData; Console.Write("FFB Size {0}", size); Console.Write(" Cmd:" + String.Format("{0:X08}", (int)FfbData->Command)); Console.Write(" ID:" + String.Format("{0:X02}", command)); Console.Write(" Size:" + String.Format("{0:D02}", (int)(size - 8))); Console.Write(" -"); for (uint i = 0; i < size - 8; i++) { Console.Write(String.Format(" {0:X02}", (uint)(bytes[i]))); } Console.WriteLine(); } }
public void DumpFrame(IntPtr data) { unsafe { InternalFfbPacket *FfbData = (InternalFfbPacket *)data; int size = FfbData->DataSize; int command = (int)FfbData->Command; byte * bytes = (byte *)FfbData->PtrToData; StringBuilder line = new StringBuilder(); line.AppendFormat(String.Format("FFB Size {0}", size)); line.AppendFormat(" Cmd:" + String.Format("{0:X08}", (int)FfbData->Command)); line.AppendFormat(" ID:" + String.Format("{0:X02}", command)); line.AppendFormat(" Size:" + String.Format("{0:D02}", (int)(size - 8))); line.AppendFormat(" -"); for (uint i = 0; i < size - 8; i++) { line.AppendFormat(String.Format(" {0:X02}", (uint)(bytes[i]))); } Log(line.ToString()); } }