本文整理汇总了C#中Tracker.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# Tracker.Parse方法的具体用法?C# Tracker.Parse怎么用?C# Tracker.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker
的用法示例。
在下文中一共展示了Tracker.Parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public static DeviceInfo Process(Tracker.Parser.Protocol protocolParser, DeviceInfo deviceInfo)
{
log.InfoFormat("{0}/Process:", _fileNm);
bool IsSequenceFirst = true;
log.DebugFormat("{0}/Process: IsSequenceFirst: {1}", _fileNm, IsSequenceFirst);
Console.WriteLine("{0} >> {1}", deviceInfo.TrackerIp, BitConverter.ToString(deviceInfo.RawData));
while ((IsSequenceFirst == true) ||
(deviceInfo.Payload != null && deviceInfo.Payload.Length >= protocolParser.REQ_MIN_Length()))
{
log.DebugFormat("{0}/Process: IsSequenceFirst: {1}, deviceInfo.Payload: {2}, REQ_MIN_Length: {3}",
_fileNm, IsSequenceFirst, deviceInfo.Payload, protocolParser.REQ_MIN_Length());
IsSequenceFirst = false;
deviceInfo.ParserStatus = ProtocolParserStatus.Initialized;
bool IsDeviceNeedToIdentify = false;
if (string.IsNullOrWhiteSpace(deviceInfo.DeviceId))
{
// new connection, first request
IsDeviceNeedToIdentify = true;
}
deviceInfo = protocolParser.Parse(deviceInfo);
if (IsDeviceNeedToIdentify)
{
deviceInfo = DeviceData.CopyLastDataOfDevice(deviceInfo);
}
log.DebugFormat("{0}/Process: deviceInfo.ParserStatus: {1}", _fileNm, deviceInfo.ParserStatus);
if (deviceInfo.ParserStatus == ProtocolParserStatus.Parsed)
{
if (DeviceData.IsActiveDevice(deviceInfo.DeviceId))
{
DeviceData.AddActiveDevice(deviceInfo.DeviceId);
DeviceData.SaveData(deviceInfo);
}
else
{
DeviceData.AddUnknownDevice(deviceInfo.DeviceId);
}
deviceInfo.ParserStatus = ProtocolParserStatus.Saved;
log.DebugFormat("{0}/Process: deviceInfo.ParserStatus: {1}", _fileNm, deviceInfo.ParserStatus);
deviceInfo = DeviceData.ClearProcessedData(deviceInfo);
deviceInfo.ParserStatus = ProtocolParserStatus.Finished;
log.DebugFormat("{0}/Process: deviceInfo.ParserStatus: {1}", _fileNm, deviceInfo.ParserStatus);
}
else
{
break;
}
}
log.InfoFormat("{0}/Process: Finished", _fileNm);
return deviceInfo;
}