Ejemplo n.º 1
0
        public static void Process(MsgDataRequest msgDataRequest)
        {
            switch (msgDataRequest.Type)
            {
            case MsgDataRequestType.Friends:
            {
                FConsole.WriteLine("Stage Completed: Sync Friendlist");

                foreach (var friend in Core.MyUser.Friends)
                {
                    var request = MsgDataRequest.CreateRequestMissedMessagesPacket(Core.MyUser.Id, friend.Key);
                    Core.Client.Send(request);
                }

                var request2 = MsgDataRequest.CreateServerListRequest(Core.MyUser.Id);
                Core.Client.Send(request2);
                break;
            }

            case MsgDataRequestType.VServers:
            {
                FConsole.WriteLine("Stage Completed: Sync VServers");
                foreach (var server in Core.MyUser.Servers)
                {
                    var request = MsgDataRequest.CreateServerChannelListRequest(Core.MyUser.Id, server.Key);
                    Core.Client.Send(request);
                }
                Core.MyUser.Servers.TryAdd(0, VirtualServer.CreateDMServer(Core.MyUser));
                Core.SelectedServer  = Core.MyUser.Servers[0];
                Core.SelectedChannel = Core.MyUser.Servers[0].Channels.Values.FirstOrDefault();
                break;
            }

            case MsgDataRequestType.Channels:
                FConsole.WriteLine("Stage Completed: Sync Channels of " + Core.MyUser.Servers[msgDataRequest.TargetId].Name);
                foreach (var server in Core.MyUser.Servers.Values)
                {
                    foreach (var channel in server.Channels)
                    {
                        var request = MsgDataRequest.CreateRequestMissedMessagesPacket(Core.MyUser.Id, server.Id, channel.Key);
                        Core.Client.Send(request);
                    }
                }
                break;

            case MsgDataRequestType.Messages:
                FConsole.WriteLine("Stage Completed: Sync Messages of " + Core.MyUser.Servers[msgDataRequest.TargetId].Channels[msgDataRequest.Param].Name);
                break;

            default:
                FConsole.WriteLine("Invalid stage.");
                break;
            }

            FConsole.WriteLine($"MsgDataRequest: {PacketRouter.Stopwatch.Elapsed.TotalMilliseconds:0.0000}ms");
        }
Ejemplo n.º 2
0
        public static void Process(MsgLogin msgLogin)
        {
            if (msgLogin.UniqueId != 0)
            {
                Core.MyUser          = new User();
                Core.MyUser.Id       = msgLogin.UniqueId;
                Core.MyUser.Username = msgLogin.GetUsername();
                Core.MyUser.Password = msgLogin.GetPassword();
                Core.Client.Socket.UseCompression = msgLogin.ClientSupportCompression;
                FConsole.WriteLine("Authentication successful. Your Username Id is: " + Core.MyUser.Id);
                var msgDataRequest = MsgDataRequest.CreateFriendListRequest(Core.MyUser.Id);
                Core.Client.Send(msgDataRequest);
            }
            else
            {
                FConsole.WriteLine("Authentication failed.");
            }

            FConsole.WriteLine($"MsgLogin Deserializing & Processing took {(((float)PacketRouter.Stopwatch.ElapsedTicks) / Stopwatch.Frequency) * 1000000000} ns");
        }
Ejemplo n.º 3
0
        public static void Process(MsgLogin msgLogin)
        {
            if (msgLogin.UniqueId != 0)
            {
                Core.MyUser          = new User();
                Core.MyUser.Id       = msgLogin.UniqueId;
                Core.MyUser.Username = msgLogin.GetUsername();
                Core.MyUser.Password = msgLogin.GetPassword();
                FConsole.WriteLine("Authentication successful. Your user Id is: " + Core.MyUser.Id);
                Core.Client.OnLoggedIn?.Invoke();
                var msgDataRequest = MsgDataRequest.CreateFriendListRequest(Core.MyUser.Id);
                Core.Client.Send(msgDataRequest);
            }
            else
            {
                FConsole.WriteLine("Authentication failed.");
            }

            FConsole.WriteLine($"MsgLogin: {PacketRouter.Stopwatch.Elapsed.TotalMilliseconds:0.0000}ms");
        }