本文整理汇总了C#中PacketParser类的典型用法代码示例。如果您正苦于以下问题:C# PacketParser类的具体用法?C# PacketParser怎么用?C# PacketParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PacketParser类属于命名空间,在下文中一共展示了PacketParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSourceRoute
public CreateSourceRoute(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.CREATE_SOURCE_ROUTE;
RouteOptions = 0x00;
FrameId = 0x00;
}
示例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 });
}
}
示例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;
}
}
示例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
}
}
示例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);
}
示例6: ModemStatus
public ModemStatus(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.MODEM_STATUS_RESPONSE;
}
示例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;
}
示例8: OverAirUpdateStatus
public OverAirUpdateStatus(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.FIRMWARE_UPDATE_STATUS;
}
示例9: SensorReadIndicator
public SensorReadIndicator(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.SENSOR_READ_INDICATOR;
ADValues = new ushort[] { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF };
}
示例10: ManyToOneRouteRequest
public ManyToOneRouteRequest(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.MANYTOONE_ROUTE_REQUEST_INDICATOR;
}
示例11: RouteRecordIndicator
public RouteRecordIndicator(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.ROUTE_RECORD_INDICATOR;
}
示例12: ExplicitAddressingTransmit
public ExplicitAddressingTransmit(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.EXPLICIT_ADDR_REQUEST;
}
示例13: ZigBeeReceivePacket
public ZigBeeReceivePacket(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.RECEIVE_PACKET_RESPONSE;
}
示例14: ATCommand
public ATCommand(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.AT_COMMAND_REQUEST;
}
示例15: RemoteCommandResponse
public RemoteCommandResponse(PacketParser parser)
{
this.parser = parser;
CommandId = XBeeAPICommandId.REMOTE_AT_COMMAND_RESPONSE;
}