Esempio n. 1
0
        public JsonResult PostData(Client client)
        {
            Client dataClient = new Client();

            dataClient.Name      = client.Name;
            dataClient.LastName  = client.LastName;
            dataClient.Email     = client.Email;
            dataClient.Phone     = client.Phone;
            dataClient.URL       = client.URL;
            dataClient.BirthDate = client.BirthDate;
            dataClient.Address   = client.Address;

            if (client.Id > 0)
            {
                dataClient.Id = client.Id;
                db.Update(dataClient);
            }
            else
            {
                db.Add(dataClient);
            }

            return(Json("success", JsonRequestBehavior.AllowGet));
            //if (ModelState.IsValid)
            //{

            //}

            //return Json("error", JsonRequestBehavior.DenyGet);
        }
Esempio n. 2
0
        public void Update(PlayerFieldFlags updateFields = PlayerFieldFlags.All)
        {
            GameClient.VersionKey = Version?.Key ?? "Unknown";

            Debug.WriteLine($"Updating values from memory (pid={process.ProcessId}, fields={updateFields})...");
            try
            {
                if (updateFields.HasFlag(PlayerFieldFlags.Name))
                {
                    UpdateName(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Guild))
                {
                    UpdateGuild(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.GuildRank))
                {
                    UpdateGuildRank(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Title))
                {
                    UpdateTitle(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Inventory))
                {
                    inventory.Update(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Equipment))
                {
                    equipment.Update(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Skillbook))
                {
                    skillbook.Update(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Spellbook))
                {
                    spellbook.Update(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Stats))
                {
                    stats.Update(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Modifiers))
                {
                    modifiers.Update(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Location))
                {
                    location.Update(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.GameClient))
                {
                    gameClient.Update(accessor);
                }

                if (updateFields.HasFlag(PlayerFieldFlags.Window))
                {
                    process.Update();
                }
            }
            catch { }
            finally
            {
                IsLoggedIn = !string.IsNullOrWhiteSpace(Name) && stats.Level > 0;
            }
        }