本文整理汇总了C#中Network.Send方法的典型用法代码示例。如果您正苦于以下问题:C# Network.Send方法的具体用法?C# Network.Send怎么用?C# Network.Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network.Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Loop
private static async Task Loop(Settings.IValues settings, Network.IBridge instance)
{
using (instance.Readings.OfType<Network.Packet.Electricity>().Subscribe(reading => WriteLine("Received Electricity Reading: {0}{1}. Total today: {2}{3}", reading.Channels[0].Current.Value, reading.Channels[0].Current.Units, reading.Channels[0].Day.Value, reading.Channels[0].Day.Units)))
{
WriteLine("Connecting to Owl at IP address: {0}", settings.OwlCommandEndpoint.ToString());
Network.Command.Response.Version version = await instance.Send(new Network.Command.Request.GetVersion());
WriteLine("Owl Firmware: {0}", version.Firmware);
WriteLine("Owl Revision: {0}", version.Revision);
WriteLine("Owl Build: {0}", version.Build);
Network.Command.Response.Rosta rosta = await instance.Send(new Network.Command.Request.GetRosta());
WriteLine("Owl connected to {0}:", "device".ToQuantity(rosta.Devices.Count()));
foreach (Tuple<int, string> device in rosta.Devices)
{
WriteLine(" Device {0}: {1}", device.Item1, device.Item2);
}
Network.Command.Response.Udp getUdp = await instance.Send(new Network.Command.Request.GetUpdPushPort());
if (!string.IsNullOrWhiteSpace(getUdp.HostName))
{
WriteLine("Owl pushing pakcets to {0} ({1})", getUdp.HostName, getUdp.Endpoint);
}
else
{
WriteLine("Owl pushing pakcets to {0}", getUdp.Endpoint);
}
if (!getUdp.Endpoint.Equals(settings.LocalPacketEndpoint))
{
WriteLine("Settings Packet Endpoint");
Network.Command.Response.Udp setUdp = await instance.Send(new Network.Command.Request.SetUdpPushPort(settings.LocalPacketEndpoint));
if (!string.IsNullOrWhiteSpace(setUdp.HostName))
{
WriteLine("Owl pushing pakcets to {0} ({1})", setUdp.HostName, setUdp.Endpoint);
}
else
{
WriteLine("Owl pushing pakcets to {0}", setUdp.Endpoint);
}
Network.Command.Response.Save save = await instance.Send(new Network.Command.Request.Save());
WriteLine("Packet Endpoint Set");
}
WriteLine("Waiting for packets. Hit return to exit.");
await ForReturn();
}
}
示例2: SendPrivateMessage
public static void SendPrivateMessage(Network.Realm.RealmClient client, string receiver, string message)
{
if (CharactersManager.CharactersList.Any(x => x.Name == receiver))
{
var character = CharactersManager.CharactersList.First(x => x.Name == receiver);
if (character.isConnected == true)
{
character.NetworkClient.Send(string.Format("cMKF|{0}|{1}|{2}", client.Player.ID, client.Player.Name, message));
client.Send(string.Format("cMKT|{0}|{1}|{2}", client.Player.ID, character.Name, message));
}
else
client.Send(string.Format("cMEf{0}", receiver));
}
}
示例3: AcceptInvitation
public static void AcceptInvitation(Network.WorldClient client, string packet)
{
if (client.Action.InvitedPartyPlayer != -1)
{
Network.WorldClient invitedClient = Helper.WorldHelper.GetClientByCharacter(client.Action.InvitedPartyPlayer);
if (invitedClient != null)
{
if (invitedClient.Character.Party != null)
{
invitedClient.Character.Party.AddMember(client);
client.Character.Party = invitedClient.Character.Party;
}
else
{
new Engines.PartyEngine(invitedClient, client);
}
invitedClient.Send("PR");
invitedClient.Action.InvitedPartyPlayer = -1;
}
else
{
client.Send("PIEn");
}
/* Reset state */
client.Action.InvitedPartyPlayer = -1;
}
else
{
client.Action.SystemMessage("Vous n'avez pas d'invitation en cours !");
}
}
示例4: ExchangeMountPaddock
public static void ExchangeMountPaddock(Network.WorldClient client, string packet)
{
int mountID = int.Parse(packet.Substring(3));
var mount = Helper.MountHelper.GetMountByID(mountID);
if (mount != null)
{
var mountTemplate = Helper.MountHelper.GetMountTemplateByType(mount.MountType);
if (mountTemplate != null)
{
if (mount.Owner == client.Character.ID)
{
var scroll = Helper.ItemHelper.GenerateItem(client, mountTemplate.ScrollID, false);
mount.ScrollID = scroll.ID;
mount.SaveAndFlush();
client.Character.Items.AddItem(scroll);
client.Send("Ee-" + mount.ID);
}
else
{
client.Action.SystemMessage("Cette monture ne vous appartient pas !");
}
}
else
{
client.Action.SystemMessage("Template de la monture introuvable !");
}
}
else
{
client.Action.SystemMessage("Impossible de trouver la monture !");
}
}
示例5: Team
public Team(Network.SocketClient Owner)
{
this.TeamID = Owner.UniqueID;
if (Members.TryAdd(Owner.UniqueID, Owner))
{
Owner.Send(Packets.ToSend.TeamPacket(Owner.UniqueID, Enums.TeamPacket.Create));
}
}
示例6: SendPartyMessage
public static void SendPartyMessage(Network.Realm.RealmClient client, string message)
{
if (client.Player.State.Party != null)
{
foreach (var character in client.Player.State.Party.Members.Keys)
character.NClient.Send(string.Format("cMK$|{0}|{1}|{2}", client.Player.ID, client.Player.Name, message));
}
else
client.Send("BN");
}
示例7: SendAdminMessage
public static void SendAdminMessage(Network.Realm.RealmClient client, string message)
{
if (client.Infos.Level > 0)
{
foreach (var character in Network.ServersHandler.RealmServer.Clients.Where(x => x.Authentified == true && x.Infos.Level > 0))
character.Send(string.Format("[email protected]|{0}|{1}|{2}", client.Player.ID, client.Player.Name, message));
}
else
client.Send("BN");
}
示例8: SendFactionMessage
public static void SendFactionMessage(Network.Realm.RealmClient client, string message)
{
if (client.Player.Faction.ID != 0 && client.Player.Faction.Level >= 3)
{
foreach (var character in Network.ServersHandler.RealmServer.Clients.Where(x => x.Authentified == true && x.Player.Faction.ID == client.Player.Faction.ID))
character.Send(string.Format("cMK!|{0}|{1}|{2}", client.Player.ID, client.Player.Name, message));
}
else
client.Send("BN");
}
示例9: SendGuildMessage
public static void SendGuildMessage(Network.Realm.RealmClient client, string message)
{
if (client.Player.Guild != null)
{
foreach (var character in client.Player.Guild.Members.Where(x => x.Character.IsConnected))
character.Character.NClient.Send(string.Format("cMK%|{0}|{1}|{2}", client.Player.ID, client.Player.Name, message));
}
else
client.Send("BN");
}
示例10: Craft
public void Craft(Network.WorldClient client)
{
var recipe = JobHelper.GetCraft(this.BaseSkill.ID, this.Items);
var chance = this.BaseSkill.GetCraftChance(this.Items.Count);
var success = false;
if (chance >= Utilities.Basic.Rand(0, 100))
{
success = true;
}
System.Threading.Thread.Sleep(750);
if (recipe != null)
{
if (success)
{
Database.Records.WorldItemRecord item = Helper.ItemHelper.GenerateItem(client, recipe.ID);
var i = client.Character.AddItem(item, 1);
client.Action.RefreshPods();
client.Send("EmKO+" + i.ID + "|1|" + recipe.ID + "|" + item.DisplayItem);
client.Send("EcK;" + recipe.ID);
client.Character.Map.Engine.Send("IO" + client.Character.ID + "|+" + recipe.ID);
client.Send("Ea1");
this.LastRecipe = this.Items.ToArray().ToList();
}
else
{
client.Send("EcEF");
}
}
else
{
client.Send("EcEI");
}
this.DeleteRecipeFromClient();
this.Job.SendJob(client);
this.Items.Clear();
this.Refresh();
this.Client.Action.SaveContents();
}
示例11: ExitParty
public static void ExitParty(Network.WorldClient client, string packet)
{
if (client.Character.Party != null)
{
int id = client.Character.ID;
if (packet.Length == 3)
{
id = int.Parse(packet.Substring(2));
}
if (client.Character.Party.Leader.Character.ID == client.Character.ID || client.Character.ID == id)
{
client.Character.Party.RemoveMember(client);
client.Send("PV" + client.Character.ID);
}
}
else
{
client.Send("BN");
}
}
示例12: SendTradeMessage
public static void SendTradeMessage(Network.Realm.RealmClient client, string message)
{
if (client.Player.CanSendinTrade() == true)
{
foreach (var character in Network.ServersHandler.RealmServer.Clients.Where(x => x.isAuth == true))
character.Send(string.Format("cMK:|{0}|{1}|{2}", client.Player.ID, client.Player.Name, message));
client.Player.RefreshTrade();
}
else
client.Send(string.Format("Im0115;{0}", client.Player.TimeTrade()));
}
示例13: SendIncarnamMessage
public static void SendIncarnamMessage(Network.Realm.RealmClient client, string message)
{
if (!client.Player.IsInIncarnam || client.Player.Level > 30)
{
client.Send("Im0139");
return;
}
foreach (var character in Network.ServersHandler.RealmServer.Clients.Where
(x => x.Authentified == true && x.Player.IsInIncarnam))
{
character.Send(string.Format("cMK^|{0}|{1}|{2}", client.Player.ID, client.Player.Name, message));
}
}
示例14: ShowPrices
public void ShowPrices(Network.WorldClient client)
{
var packet = new StringBuilder("EHl");
packet.Append(this.ItemID).Append("|");
var items = this.Rows;
for (int i = 0; i < items.Count; i++)
{
var item = items[i];
if (i != 0) packet.Append("|");
packet.Append(item.RowID).Append(";").Append(item.GetStockStats()).Append(";")
.Append(item.HaveThisQuantity(1) ? item.GetFirstOfQuantity(1).SellPrice.ToString() : "").Append(";")
.Append(item.HaveThisQuantity(10) ? item.GetFirstOfQuantity(10).SellPrice.ToString() : "").Append(";")
.Append(item.HaveThisQuantity(100) ? item.GetFirstOfQuantity(100).SellPrice.ToString() : "").Append(";");
}
client.Send(packet.ToString());
}
示例15: BoostSpell
public static void BoostSpell(Network.WorldClient client, string packet)
{
int spellID = int.Parse(packet.Substring(2));
if (client.Character.Spells.HaveSpell(spellID))
{
Game.Spells.WorldSpell spell = client.Character.Spells.GetSpell(spellID);
if (spell.Level < 6 && client.Character.SpellPoint >= spell.Level)
{
if (spell.Level == 5 && client.Character.Level < (spell.Level + 100)) { return; }
client.Character.SpellPoint -= spell.Level;
spell.Level++;
client.Send("SUK" + spellID + "~" + spell.Level);
client.Character.Stats.RefreshStats();
}
}
}