本文整理汇总了C#中PacketParser类的典型用法代码示例。如果您正苦于以下问题:C# PacketParser类的具体用法?C# PacketParser怎么用?C# PacketParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PacketParser类属于命名空间,在下文中一共展示了PacketParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateSourceRoute
public CreateSourceRoute(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.CREATE_SOURCE_ROUTE;
RouteOptions = 0x00;
FrameId = 0x00;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:7,代码来源:CreateSourceRoute.cs
示例2: HandleInitFactions
static void HandleInitFactions(PacketParser parser)
{
var reps = parser.ParsedPacket.List;
for (var i = 0; i < reps.Count; i++)
{
var rep = reps[i];
var index = (FactionReputationIndex)i;
var value = rep["Value"].IntValue;
InfosById.Add(index, new ReputationInfo(index) { Value = value });
}
}
开发者ID:remixod,项目名称:netServer,代码行数:13,代码来源:TrainerInfoExtractor.cs
示例3: UpdateReputations
static void UpdateReputations(PacketParser parser)
{
var reps = parser.ParsedPacket["Factions"].List;
foreach (var rep in reps)
{
var id = (FactionReputationIndex)rep["Faction"].UIntValue;
var value = rep["Value"].IntValue;
var info = GetInfo(id);
info.Value += value;
}
}
开发者ID:remixod,项目名称:netServer,代码行数:13,代码来源:TrainerInfoExtractor.cs
示例4: HandleTrainerList
static void HandleTrainerList(PacketParser parser)
{
var spells = parser.ParsedPacket["Spells"].List;
foreach (var spellSegment in spells)
{
var id = (SpellId)spellSegment["Spell"].UIntValue;
var moneyCost = spellSegment["MoneyCost"].IntValue;
var talentCost = spellSegment["TalentCost"].IntValue;
var profCost = spellSegment["ProfessionPointCost"].IntValue;
int reqLevel = spellSegment["RequiredLevel"].ByteValue;
var reqSkill = (SkillId)spellSegment["RequiredSkill"].UIntValue;
var reqSkillValue = spellSegment["RequiredSkillLevel"].IntValue;
var reqSpells = new SpellId[3];
reqSpells[0] = (SpellId)spellSegment["RequiredSpellId1"].UIntValue;
reqSpells[1] = (SpellId)spellSegment["RequiredSpellId2"].UIntValue;
reqSpells[2] = (SpellId)spellSegment["RequiredSpellId3"].UIntValue;
// TODO: Calc exact money cost, depending on the faction
}
}
开发者ID:remixod,项目名称:netServer,代码行数:21,代码来源:TrainerInfoExtractor.cs
示例5: Initialize
/// <summary>
/// Intializes <see cref="InputAdapter"/>.
/// </summary>
public override void Initialize()
{
Dictionary<string, string> settings = Settings;
string value;
// Example connection string:
// Port=1003; ServerID=P3
if (settings.TryGetValue("port", out value))
m_archiverPort = int.Parse(value);
if (settings.TryGetValue("historianid", out value))
m_historianID = value.Trim().ToUpper();
// Create new data parser
m_parser = new PacketParser();
m_parser.DataParsed += m_parser_DataParsed;
// Create UDP client to listen for messages
m_client = new UdpClient("localport=" + m_archiverPort);
m_client.ConnectionEstablished += m_client_ConnectionEstablished;
m_client.ConnectionTerminated += m_client_ConnectionTerminated;
m_client.ConnectionException += m_client_ConnectionException;
m_client.Handshake = false;
// Send data received over UDP port directly to packet parser
m_client.ReceiveDataHandler = (buffer, offset, count) => m_parser.Parse(Guid.Empty, buffer, offset, count);
}
开发者ID:rmc00,项目名称:gsf,代码行数:30,代码来源:InputAdapter.cs
示例6: ModemStatus
public ModemStatus(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.MODEM_STATUS_RESPONSE;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:ModemStatus.cs
示例7: DataListener
/// <summary>
/// Initializes a new instance of the <see cref="DataListener"/> class.
/// </summary>
public DataListener()
{
m_id = DefaultID;
m_server = DefaultServer;
m_port = DefaultPort;
m_protocol = DefaultProtocol;
m_connectToServer = DefaultConnectToServer;
m_cacheData = DefaultCacheData;
m_initializeData = DefaultInitializeData;
m_initializeDataTimeout = DefaultInitializeDataTimeout;
m_persistSettings = DefaultPersistSettings;
m_settingsCategory = DefaultSettingsCategory;
m_data = new List<IDataPoint>();
m_clientIDs = new ConcurrentDictionary<IClient, Guid>();
m_initializeWaitHandle = new AutoResetEvent(false);
m_parser = new PacketParser();
m_parser.DataParsed += PacketParser_DataParsed;
m_tcpClient = new TcpClient();
m_tcpClient.ConnectionAttempt += ClientSocket_ConnectionAttempt;
m_tcpClient.ConnectionEstablished += ClientSocket_ConnectionEstablished;
m_tcpClient.ConnectionTerminated += ClientSocket_ConnectionTerminated;
m_tcpClient.ReceiveDataComplete += ClientSocket_ReceiveDataComplete;
m_clientIDs.TryAdd(m_tcpClient, Guid.NewGuid());
m_udpClient = new UdpClient();
m_udpClient.ConnectionAttempt += ClientSocket_ConnectionAttempt;
m_udpClient.ConnectionEstablished += ClientSocket_ConnectionEstablished;
m_udpClient.ConnectionTerminated += ClientSocket_ConnectionTerminated;
m_udpClient.ReceiveDataComplete += ClientSocket_ReceiveDataComplete;
m_clientIDs.TryAdd(m_udpClient, Guid.NewGuid());
m_tcpServer = new TcpServer();
m_tcpServer.ServerStarted += ServerSocket_ServerStarted;
m_tcpServer.ServerStopped += ServerSocket_ServerStopped;
m_tcpServer.ReceiveClientDataComplete += ServerSocket_ReceiveClientDataComplete;
m_dataInitClient = new TcpClient();
m_dataInitClient.ConnectionString = "Server={0}:1003; interface=0.0.0.0";
m_dataInitClient.PayloadAware = true;
m_dataInitClient.MaxConnectionAttempts = 10;
m_dataInitClient.ReceiveDataComplete += DataInitClient_ReceiveDataComplete;
}
开发者ID:GridProtectionAlliance,项目名称:gsf,代码行数:47,代码来源:DataListener.cs
示例8: OverAirUpdateStatus
public OverAirUpdateStatus(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.FIRMWARE_UPDATE_STATUS;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:OverAirUpdateStatus.cs
示例9: SensorReadIndicator
public SensorReadIndicator(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.SENSOR_READ_INDICATOR;
ADValues = new ushort[] { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF };
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:6,代码来源:SensorReadIndicator.cs
示例10: ManyToOneRouteRequest
public ManyToOneRouteRequest(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.MANYTOONE_ROUTE_REQUEST_INDICATOR;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:ManyToOneRouteRequest.cs
示例11: RouteRecordIndicator
public RouteRecordIndicator(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.ROUTE_RECORD_INDICATOR;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:RouteRecordIndicator.cs
示例12: ExplicitAddressingTransmit
public ExplicitAddressingTransmit(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.EXPLICIT_ADDR_REQUEST;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:ExplicitAddressingTransmit.cs
示例13: ZigBeeReceivePacket
public ZigBeeReceivePacket(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.RECEIVE_PACKET_RESPONSE;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:ZigBeeReceivePacket.cs
示例14: ATCommand
public ATCommand(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.AT_COMMAND_REQUEST;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:ATCommand.cs
示例15: RemoteCommandResponse
public RemoteCommandResponse(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.REMOTE_AT_COMMAND_RESPONSE;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:RemoteCommandResponse.cs
示例16: ZigBeeTransmitStatus
public ZigBeeTransmitStatus(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.TRANSMIT_STATUS_RESPONSE;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:ZigBeeTransmitStatus.cs
示例17: DoParse
protected virtual void DoParse(ParsablePacketInfo info, LogHandler handler)
{
var rawPacket = info.Packet;
if (rawPacket.PacketId.IsUpdatePacket)
{
var len = rawPacket.Length - rawPacket.HeaderSize;
var bytes = rawPacket.ReadBytes(len);
if (bytes.Length != len)
{
log.Warn("BinaryReader.ReadBytes failed: {0} / {1}", bytes.Length, len);
return;
}
var updatePacket = ParsedUpdatePacket.Create(info.Timestamp,
bytes,
false,
rawPacket.PacketId == RealmServerOpCode.SMSG_COMPRESSED_UPDATE_OBJECT);
if (handler.UpdatePacketHandler != null)
{
handler.UpdatePacketHandler(updatePacket);
}
}
else
{
var parser = new PacketParser(info);
parser.Parse();
if (handler.NormalPacketHandler != null)
{
handler.NormalPacketHandler(parser);
}
}
}
开发者ID:ebakkedahl,项目名称:WCell,代码行数:33,代码来源:AdvancedLogParser.cs
示例18: HandleQuestPackets
/// <summary>
/// Write human-readable version of log to ParsedQuestOutput.txt
/// </summary>
/// <param name="parser">Any kind of Quest-packet</param>
public static void HandleQuestPackets(PacketParser parser)
{
parser.Dump(questWriter);
questWriter.WriteLine(); // empty line in between entries
}
开发者ID:ebakkedahl,项目名称:WCell,代码行数:9,代码来源:MixedSample.cs
示例19: HandlePacket
protected static void HandlePacket(PacketParser parser)
{
var pac = parser.ParsedPacket;
s_Writer.WriteLine(@"INSERT INTO `gameobject_roots` KEYS (entry, Type, displayid, Name) " +
"VALUES ({0}, {1}, {2}, {3})", pac["Entry"].UIntValue, pac["Type"].UIntValue, pac["DisplayId"].UIntValue, pac["Name"].StringValue);
}
开发者ID:pallmall,项目名称:WCell,代码行数:6,代码来源:GOSerializer.cs
示例20: ZigBeeExplicitRXIndicator
public ZigBeeExplicitRXIndicator(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.EXPLICIT_RX_INDICATOR_RESPONSE;
}
开发者ID:chrisreedio,项目名称:xbee-api-sharp,代码行数:5,代码来源:ZigBeeExplicitRXIndicator.cs
注:本文中的PacketParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论