本文整理汇总了C#中PacketWriter类的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter类的具体用法?C# PacketWriter怎么用?C# PacketWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PacketWriter类属于命名空间,在下文中一共展示了PacketWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Session
public Session( World _world, TcpClient _client ) {
world = _world;
loginTime = DateTime.Now;
canReceive = true;
canQueue = true;
canSend = false;
canDispose = false;
outputQueue = new Queue<Packet>();
priorityOutputQueue = new Queue<Packet>();
queueLock = new object();
priorityQueueLock = new object();
client = _client;
client.SendTimeout = 10000;
client.ReceiveTimeout = 10000;
reader = new BinaryReader( client.GetStream() );
writer = new PacketWriter( new BinaryWriter( client.GetStream() ) );
world.log.Log( "Session: {0}", LogType.Debug, ToString() );
ioThread = new Thread( IoLoop );
ioThread.IsBackground = true;
ioThread.Start();
}
开发者ID:fragmer,项目名称:fCraft,代码行数:28,代码来源:Session.cs
示例2: ForceLeave
public static void ForceLeave(Client pClient)
{
if (pClient.mStage == null)
return;
MMatchStage stage = pClient.mStage;
pClient.mStage = null;
pClient.mClientFlags = PacketFlags.Character;
pClient.mPlace = MMatchPlace.Lobby;
PacketWriter pPacket = new PacketWriter(Operation.StageLeave, CryptFlags.Encrypt);
pPacket.Write(pClient.mClientUID);
foreach (Client c in stage.Clients)
{
if (pClient == c) continue;
c.Send(pPacket);
}
lock (stage)
{
stage.Clients.Remove(pClient);
if (stage.Clients.Count == 0)
{
lock (pClient.mChannel.lStages)
pClient.mChannel.lStages.Remove(stage);
StageList(pClient);
return;
}
}
UpdateStageCache(stage, pClient, ObjectCache.New);
stage.stageMaster = stage.Clients[0];
UpdateMaster(stage);
}
开发者ID:Theoretical,项目名称:Infamous,代码行数:33,代码来源:StageMgr.cs
示例3: News
public static byte[] News()
{
PacketWriter Writer = new PacketWriter();
Writer.Create(SERVER.SERVER_MAIN);
Writer.Byte(0);
Writer.Byte((byte)Systems.News_List.Count);
foreach (NewsList n in Systems.News_List)
{
Writer.Text(n.Head);
Writer.Text(n.Msg);
Writer.Word(0);
Writer.Word(n.Month);
Writer.Word(n.Day);
Writer.Word(0);
Writer.LWord(0);
}
Writer.Word(0);
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:25,代码来源:Packet_News.cs
示例4: TeleportOtherStart
public static byte[] TeleportOtherStart()
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_TELEPORTOTHERSTART);
Writer.DWord(0);
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:7,代码来源:TeleportPackets.cs
示例5: UpdatePlace
public static byte[] UpdatePlace()
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_SAVE_PLACE);
Writer.Byte(1);
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:7,代码来源:TeleportPackets.cs
示例6: Create
/// <summary>
/// </summary>
/// <param name="username">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(string username)
{
PacketWriter writer = new PacketWriter(0x07);
IEnumerable<DBCharacter> chars = CharacterDao.Instance.GetAllForUser(username);
byte[] numberOfCharacters = BitConverter.GetBytes(IPAddress.HostToNetworkOrder((Int16)chars.Count()));
writer.WriteBytes(numberOfCharacters);
foreach (DBCharacter character in chars)
{
writer.WriteUInt32((UInt32)character.Id);
}
writer.WriteBytes(numberOfCharacters);
foreach (DBCharacter character in chars)
{
writer.WriteString(character.Name);
}
writer.WriteBytes(numberOfCharacters);
foreach (DBCharacter character in chars)
{
writer.WriteUInt32((UInt32)StatDao.Instance.GetById(50000, character.Id, 54).StatValue);
}
writer.WriteBytes(numberOfCharacters);
foreach (DBCharacter character in chars)
{
writer.WriteUInt32((uint)CharacterDao.Instance.IsOnline(character.Id));
}
return writer.Finish();
}
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:38,代码来源:AccountCharacterList.cs
示例7: FriendGroupManage
public static byte[] FriendGroupManage(string type,string groupname, short groupid, int targetid)
{
PacketWriter Writer = new PacketWriter();
switch (type)
{
case "ADD":
Writer.Create(Systems.SERVER_FRIEND_GROUP);
Writer.Byte(1);
Writer.Text(groupname);
Writer.Word(groupid);
break;
case "REMOVE":
Writer.Create(Systems.SERVER_FRIEND_GROUP_REMOVE);
Writer.Byte(1);
Writer.Word(groupid);
break;
case "MOVE":
Writer.Create(Systems.SERVER_FRIEND_GROUP_MANAGE_FRIEND);
Writer.Byte(1);
Writer.DWord(targetid);
Writer.Word(groupid);
break;
}
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:25,代码来源:FriendsPackets.cs
示例8: ProcessLiveCheck
public static void ProcessLiveCheck(Client pClient, PacketReader pPacket)
{
var timeStamp = pPacket.ReadInt32();
PacketWriter pResponseLiveCheck = new PacketWriter(Operation.MatchAgentResponseLiveCheck, CryptFlags.Encrypt);
pResponseLiveCheck.Write(timeStamp);
pClient.Send(pResponseLiveCheck);
}
开发者ID:Theoretical,项目名称:Infamous,代码行数:7,代码来源:Agent.cs
示例9: Write
public override void Write(PacketWriter w)
{
w.Write(Time);
w.Write(BulletId);
w.Write(ObjectId);
w.Write(TargetId);
}
开发者ID:Zeroeh,项目名称:K_Relay,代码行数:7,代码来源:OtherHitPacket.cs
示例10: ResponseCharacterItemList
public static void ResponseCharacterItemList(Client client)
{
using (var packet = new PacketWriter(Operation.MatchResponseCharacterItemList, CryptFlags.Decrypt))
{
packet.Write(client.GetCharacter().Bp);
packet.Write(17, 8);
for (var i = 0; i < 17; ++i)
{
packet.Write(0);
packet.Write(client.GetCharacter().EquippedItems[i].ItemCid);
}
packet.Write(client.GetCharacter().Items.Count, 24);
foreach (var i in client.GetCharacter().Items)
{
packet.Write(0);
packet.Write(i.ItemCid);
packet.Write(i.ItemId);
packet.Write(i.RentHour);
packet.Write(0);
packet.Write(i.Quantity);
}
packet.Write(0, 12);
client.Send(packet);
}
}
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:28,代码来源:Match.cs
示例11: Packet
//constructors
public Packet(Packet rhs)
{
lock (rhs.m_lock)
{
m_lock = new object();
m_opcode = rhs.m_opcode;
m_encrypted = rhs.m_encrypted;
m_massive = rhs.m_massive;
m_locked = rhs.m_locked;
if (!m_locked)
{
m_writer = new PacketWriter();
m_reader = null;
m_reader_bytes = null;
m_writer.Write(rhs.m_writer.GetBytes());
}
else
{
m_writer = null;
m_reader_bytes = rhs.m_reader_bytes;
m_reader = new PacketReader(m_reader_bytes);
}
}
}
开发者ID:dawnoble,项目名称:blackcatproject,代码行数:27,代码来源:Packet.cs
示例12: Exchange_Approve
public static byte[] Exchange_Approve()
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_EXCHANGE_APPROVE);
Writer.Byte(1);
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:7,代码来源:ExchangePackets.cs
示例13: Exchange_Accept
public static byte[] Exchange_Accept()
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_EXCHANGE_ACCEPT);
Writer.Byte(1);
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:7,代码来源:ExchangePackets.cs
示例14: CloseExhangeWindow
public static byte[] CloseExhangeWindow()
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_EXCHANGE_CLOSE);
Writer.Bool(true);
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:7,代码来源:ExchangePackets.cs
示例15: AlchemyResponse
public static byte[] AlchemyResponse(bool isSuccess, Global.slotItem sItem, byte type, byte totalblue)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_ALCHEMY);
Writer.Byte(1);
Writer.Byte(2);
Writer.Bool(isSuccess);
Writer.Byte(sItem.Slot);
if (!isSuccess) { Writer.Byte(0); }
Writer.DWord(0);
Writer.DWord(sItem.ID);
Writer.Byte(sItem.PlusValue);
Writer.LWord(0);
Writer.DWord(sItem.Durability);
Writer.Byte(Data.ItemBlue[sItem.dbID].totalblue);
for (int i = 0; i <= Data.ItemBlue[sItem.dbID].totalblue - 1; i++)
{
Writer.DWord(Data.MagicOptions.Find(mg => (mg.Name == Convert.ToString(Data.ItemBlue[sItem.dbID].blue[i]))).ID);
Writer.DWord(Data.ItemBlue[sItem.dbID].blueamount[i]);
}
Writer.Word(1);
Writer.Word(2);
Writer.Word(3);
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:26,代码来源:AlchemyPackets.cs
示例16: WriteCommand
public void WriteCommand(PacketWriter writer)
{
writer.WriteInt32(BuildingID);
writer.WriteInt32(Unknown1);
writer.WriteInt32(Unknown2);
writer.WriteInt32(Unknown3);
}
开发者ID:jibinthomas007,项目名称:CoCSharp,代码行数:7,代码来源:UpgradeUnitCommand.cs
示例17: Create
/// <summary>
/// The create.
/// </summary>
/// <param name="privategroupid">
/// </param>
/// <param name="playerid">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(uint privategroupid, uint playerid)
{
PacketWriter writer = new PacketWriter(55);
writer.WriteUInt32(privategroupid);
writer.WriteUInt32(playerid);
return writer.Finish();
}
开发者ID:kittin,项目名称:CellAO-NightPredator,代码行数:16,代码来源:PrivateGroupPlayerJoined.cs
示例18: instance
public static PacketWriter instance()
{
if (_instance == null)
_instance = new PacketWriter();
return _instance;
}
开发者ID:ghetzel,项目名称:wincollectd,代码行数:7,代码来源:PacketWriter.cs
示例19: FriendData
public static byte[] FriendData(int target, byte type, string name, character c, bool state)
{
PacketWriter Writer = new PacketWriter();
Writer.Create(Systems.SERVER_FRIEND_DATA);
switch (type)
{
case 2:
//Friend invite accepted
Writer.Byte(2);
Writer.DWord(target); //Id
Writer.Text(c.Information.Name); //Name
Writer.DWord(c.Information.Model); //Model
break;
case 3:
//Remove friend from own list
Writer.Byte(3);
Writer.DWord(target);
break;
case 4:
//Fried online / offline update
Writer.Byte(4);
Writer.DWord(target);
Writer.Byte(state);
break;
case 5:
//Send private message..
Writer.Byte(8);
Writer.Text(name);
Writer.DWord(0);
Writer.DWord(0);//time info
break;
}
return Writer.GetBytes();
}
开发者ID:CarlosX,项目名称:DarkEmu,代码行数:34,代码来源:FriendsPackets.cs
示例20: Create
/// <summary>
/// The create.
/// </summary>
/// <param name="playerid">
/// </param>
/// <param name="playername">
/// </param>
/// <returns>
/// </returns>
public static byte[] Create(uint playerid, string playername)
{
PacketWriter writer = new PacketWriter(21);
writer.WriteUInt32(playerid);
writer.WriteString(playername);
return writer.Finish();
}
开发者ID:kittin,项目名称:CellAO-NightPredator,代码行数:16,代码来源:NameLookupResult.cs
注:本文中的PacketWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论