Beispiel #1
0
        public static void HandleGetAuthenticationResponse(Client client, GetAuthenticationResponse packet)
        {
            if (client.EndPoint.Address.ToString() == "255.255.255.255" || packet.Id.Length != 64)
            {
                return;
            }

            try
            {
                client.Value.Version         = packet.Version;
                client.Value.OperatingSystem = packet.OperatingSystem;
                client.Value.AccountType     = packet.AccountType;
                client.Value.Country         = packet.Country;
                client.Value.CountryCode     = packet.CountryCode;
                client.Value.Region          = packet.Region;
                client.Value.City            = packet.City;
                client.Value.Id         = packet.Id;
                client.Value.Username   = packet.Username;
                client.Value.PCName     = packet.PcName;
                client.Value.Tag        = packet.Tag;
                client.Value.ImageIndex = packet.ImageIndex;

                client.Value.DownloadDirectory = (!FileHelper.CheckPathForIllegalChars(client.Value.UserAtPc)) ?
                                                 Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.Value.UserAtPc, client.Value.Id.Substring(0, 7))) :
                                                 Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.EndPoint.Address, client.Value.Id.Substring(0, 7)));

                // TODO: Refactor tooltip
                //if (Settings.ShowToolTip)
                //    client.Send(new GetSystemInfo());
            }
            catch
            {
            }
        }
Beispiel #2
0
        private bool AuthenticateClient(Client client, GetAuthenticationResponse packet)
        {
            if (packet.Id.Length != 64)
            {
                return(false);
            }

            client.Value.Version         = packet.Version;
            client.Value.OperatingSystem = packet.OperatingSystem;
            client.Value.AccountType     = packet.AccountType;
            client.Value.Country         = packet.Country;
            client.Value.CountryCode     = packet.CountryCode;
            client.Value.Region          = packet.Region;
            client.Value.City            = packet.City;
            client.Value.Id         = packet.Id;
            client.Value.Username   = packet.Username;
            client.Value.PcName     = packet.PcName;
            client.Value.Tag        = packet.Tag;
            client.Value.ImageIndex = packet.ImageIndex;

            // TODO: Refactor tooltip
            //if (Settings.ShowToolTip)
            //    client.Send(new GetSystemInfo());

            return(true);
        }
        public static void HandleGetAuthenticationResponse(ClientMosaic client, GetAuthenticationResponse packet)
        {
            if (client.endPoint.Address.ToString() == "255.255.255.255")
            {
                return;
            }

            try
            {
                client.value.version         = packet.version;
                client.value.operatingSystem = packet.operatingSystem;
                client.value.accountType     = packet.accountType;
                client.value.country         = packet.country;
                client.value.countryCode     = packet.countryCode;
                client.value.city            = packet.city;
                client.value.imageIndex      = packet.imageIndex;
                client.value.id   = packet.id;
                client.value.name = packet.name;

                client.value.downloadDirectory = (checkPathForIllegalChars(client.value.name)) ?
                                                 Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.value.name, client.value.id.Substring(0, 7))) :
                                                 Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.endPoint.Address, client.value.id.Substring(0, 7)));
            }
            catch
            {
            }
        }
Beispiel #4
0
        public static void HandleGetAuthenticationResponse(Client client, GetAuthenticationResponse packet)
        {
            if (client.EndPoint.Address.ToString() == "255.255.255.255" || packet.Id.Length != 64)
            {
                return;
            }

            try
            {
                client.Value.Version         = packet.Version;
                client.Value.OperatingSystem = packet.OperatingSystem;
                client.Value.AccountType     = packet.AccountType;
                client.Value.Country         = packet.Country;
                client.Value.CountryCode     = packet.CountryCode;
                client.Value.Region          = packet.Region;
                client.Value.City            = packet.City;
                client.Value.Id       = packet.Id;
                client.Value.Username = packet.Username;
                client.Value.PCName   = packet.PCName;
                client.Value.Tag      = packet.Tag;

                string userAtPc = string.Format("{0}@{1}", client.Value.Username, client.Value.PCName);

                client.Value.DownloadDirectory = (!FileHelper.CheckPathForIllegalChars(userAtPc)) ?
                                                 Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", userAtPc, client.Value.Id.Substring(0, 7))) :
                                                 Path.Combine(Application.StartupPath, string.Format("Clients\\{0}_{1}\\", client.EndPoint.Address, client.Value.Id.Substring(0, 7)));

                FrmMain.Instance.ConServer.CountAllTimeConnectedClientById(client.Value.Id);

                string country = string.Format("{0} [{1}]", client.Value.Country, client.Value.CountryCode);

                // this " " leaves some space between the flag-icon and first item
                ListViewItem lvi = new ListViewItem(new string[]
                {
                    " " + client.EndPoint.Address, client.Value.Tag,
                    userAtPc, client.Value.Version, "Connected", "Active", country,
                    client.Value.OperatingSystem, client.Value.AccountType
                })
                {
                    Tag = client, ImageIndex = packet.ImageIndex
                };

                FrmMain.Instance.AddClientToListview(lvi);

                if (Settings.ShowPopup)
                {
                    FrmMain.Instance.ShowPopup(client);
                }

                client.Value.IsAuthenticated = true;
                if (Settings.ShowToolTip)
                {
                    new Packets.ServerPackets.GetSystemInfo().Execute(client);
                }
            }
            catch
            {
            }
        }
Beispiel #5
0
        public static void HandleGetAuthenticationResponse(Client client, GetAuthenticationResponse packet)
        {
            if (client.EndPoint.Address.ToString() == "255.255.255.255" || packet.Id.Length != 64)
            {
                return;
            }

            try
            {
                client.Value.Versiyon       = packet.Version;
                client.Value.IşletimSistemi = packet.OperatingSystem;
                client.Value.HesapTürü      = packet.AccountType;
                client.Value.Ülke           = packet.Country;
                client.Value.ÜlkeKodu       = packet.CountryCode;
                client.Value.Bölge          = packet.Region;
                client.Value.Şehir          = packet.City;
                client.Value.Id             = packet.Id;
                client.Value.KullanıcıAdi   = packet.Username;
                client.Value.PcAdi          = packet.PCName;
                client.Value.Etiket         = packet.Tag;
                client.Value.ImageIndex     = packet.ImageIndex;

                client.Value.DownloadDirectory = (!DosyaYardımcısı.CheckPathForIllegalChars(client.Value.KullanıcıPcde))
                    ? Path.Combine(Application.StartupPath,
                                   string.Format("Kurbanlar\\{0}_{1}\\", client.Value.KullanıcıPcde, client.Value.Id.Substring(0, 7)))
                    : Path.Combine(Application.StartupPath,
                                   string.Format("Kurbanlar\\{0}_{1}\\", client.EndPoint.Address, client.Value.Id.Substring(0, 7)));

                if (Ayarlar.ShowToolTip)
                {
                    new GetSystemInfo().Execute(client);
                }
            }
            catch
            {
            }
        }