当前位置: 首页>>代码示例>>C#>>正文


C# Database.MySqlCommand类代码示例

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


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

示例1: GetMembers

        public static void GetMembers()
        {
            foreach (KeyValuePair<uint, Game.Clans> G in Conquer_Online_Server.ServerBase.Kernel.ServerClans)
            {
                Game.Clans clan = G.Value;
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
                cmd.Select("entities").Where("ClanID", clan.ClanId);
                MySqlReader r = new MySqlReader(cmd);
                while (r.Read())
                {

                    Game.ClanMembers member = new Conquer_Online_Server.Game.ClanMembers();
                    member.Donation = r.ReadUInt32("ClanDonation");
                    member.Rank = r.ReadByte("ClanRank");
                    member.UID = r.ReadUInt32("UID");
                    member.Name = r.ReadString("Name");
                    member.Class = r.ReadUInt16("Class");
                    member.Level = r.ReadByte("Level");

                    if (!clan.Members.ContainsKey(member.UID))
                        clan.Members.Add(member.UID, member);
                }
                r.Close();
            }
        }
开发者ID:faresali,项目名称:co-pserver,代码行数:25,代码来源:Clans.cs

示例2: Inscribe

 public static void Inscribe(Game.ConquerStructures.Society.ArsenalType Type, uint Donation, Interfaces.IConquerItem item, Game.Entity Entity)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
     cmd.Insert("guild_arsenalsdonation").Insert("d_uid", Entity.UID).Insert("guild_uid", Entity.GuildID).Insert("name", Entity.Name).Insert("item_uid", item.UID).Insert("item_donation", Donation).Insert("item_arsenal_type", (byte)Type).Execute();
     cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd.Update("items").Set("Inscribed", 1).Where("UID", item.UID).Execute();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:7,代码来源:ArsenalsTable.cs

示例3: AccountTable

 public AccountTable(string username)
 {
     if (BannedIPs.Count == 0 && !LoadedIPs)
     {
         string[] lines = File.ReadAllLines(ServerBase.Constants.BannedPath);
         foreach (string line in lines)
         {
             if (line.Length >= 7)
             {
                 BannedIPs.Add(line.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)[0]);
             }
         }
         LoadedIPs = true;
     }
     this.Username = username;
     this.Password = "";
     this.IP = "";
     this.LastCheck = DateTime.Now;
     this.State = AccountState.DoesntExist;
     this.EntityID = 0;
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("accounts").Where("Username", username);
     MySqlReader r = new MySqlReader(cmd);
     if (r.Read())
     {
         exists = true;
         this.Password = r.ReadString("Password");
         this.IP = r.ReadString("IP");
         this.EntityID = r.ReadUInt32("EntityID");
         this.LastCheck = DateTime.FromBinary(r.ReadInt64("LastCheck"));
         this.State = (AccountState)r.ReadByte("State");
         this.Email = r.ReadString("Email");
     }
     r.Close();
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:35,代码来源:AccountTable.cs

示例4: SaveProficiencies

 public static void SaveProficiencies(Client.GameState client)
 {
     if (client.Entity == null)
         return;
     if (client.Proficiencies == null)
         return;
     if (client.Proficiencies.Count == 0)
         return;
     foreach (Interfaces.ISkill proficiency in client.Proficiencies.Values)
     {
         if(proficiency.Available)
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
             cmd.Update("skills").Set("Level", proficiency.Level).Set("PreviousLevel", proficiency.PreviousLevel)
                 .Set("Experience", proficiency.Experience).Where("EntityID", client.Entity.UID).And("ID", proficiency.ID).Execute();
         }
         else
         {
             proficiency.Available = true;
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
             cmd.Insert("skills").Insert("Level", proficiency.Level).Insert("Experience", proficiency.Experience).Insert("EntityID", client.Entity.UID)
                 .Insert("Type", "Proficiency").Insert("ID", proficiency.ID).Execute();
         }
     }
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:25,代码来源:Copy+of+SkillTable.cs

示例5: CreateArsenal

 public static void CreateArsenal(ushort gID, Game.ConquerStructures.Society.ArsenalType Type)
 {
     if (!ContainsArsenal(gID))
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
         cmd.Insert("guild_arsenals").Insert("guild_uid", gID).Execute();
     }
     else
     {
         string val = "";
         switch (Type)
         {
             case ArsenalType.Headgear: val = "head_allowed"; break;
             case ArsenalType.Armor: val = "armor_allowed"; break;
             case ArsenalType.Weapon: val = "weapon_allowed"; break;
             case ArsenalType.Ring: val = "ring_allowed"; break;
             case ArsenalType.Boots: val = "boots_allowed"; break;
             case ArsenalType.Necklace: val = "neck_allowed"; break;
             case ArsenalType.Fan: val = "fan_allowed"; break;
             case ArsenalType.Tower: val = "tower_allowed"; break;
         }
         if (val != "")
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
             cmd.Update("guild_arsenals").Set(val, 1).Execute();
         }
     }
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:28,代码来源:ArsenalsTable.cs

示例6: Delete

 public static void Delete(uint UID)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE);
     cmd.Delete("guild_arsenalsdonation", "item_uid", UID).Execute();
     cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd.Update("items").Set("Inscribed", 0).Where("UID", UID).Execute();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:7,代码来源:ArsenalsTable.cs

示例7: DeleteItem

 public static void DeleteItem(uint UID)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE);
     int res = cmd.Delete("items", "UID", UID).Execute();
     MySqlCommand cmds = new MySqlCommand(MySqlCommandType.DELETE).Delete("items", "UID", UID);
     cmds.Execute();
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:7,代码来源:ConquerItemTable.cs

示例8: KickClan

 public static void KickClan(string name)
 {
     MySqlCommand cmd3 = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd3.Update("entities").Set("ClanDonation", 0)
         .Set("ClanRank", 0)
         .Set("ClanID", 0).Where("Name", name).Execute();
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:7,代码来源:Clans.cs

示例9: Update56

 public static void Update56(Conquer_Online_Server.Game.Entity Entity)
 {
     MySqlCommand Command = new MySqlCommand(MySqlCommandType.UPDATE);
     Command.Update("entities")
         .Set("My_Title", Entity.TitleActivated)
         .Where("UID", Entity.UID)
         .Execute();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:8,代码来源:SubClassTable.cs

示例10: Update

 public static void Update(Game.Entity Entity)
 {
     MySqlCommand Command = new MySqlCommand(MySqlCommandType.UPDATE);
     Command.Update("entities")
         .Set("StudyPoints", Entity.SubClasses.StudyPoints)
         .Where("UID", Entity.UID)
         .Execute();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:8,代码来源:SubClassTable.cs

示例11: Disband

 public static void Disband(Game.ConquerStructures.Society.Guild guild)
 {
     MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
     command.Update("entities").Set("GuildID", 0).Where("GuildID", guild.ID).Execute();
     ServerBase.Kernel.Guilds.Remove(guild.ID);
     command = new MySqlCommand(MySqlCommandType.DELETE);
     command.Delete("guilds", "ID", guild.ID).Execute();
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:8,代码来源:GuildTable.cs

示例12: Insert

 public static void Insert(Game.Entity Entity, byte id)
 {
     MySqlCommand Command = new MySqlCommand(MySqlCommandType.INSERT);
     Command.Insert("subclasses")
         .Insert("uid", id)
         .Insert("id", Entity.UID)
         .Execute();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:8,代码来源:SubClassTable.cs

示例13: activateVip

 public static void activateVip(Client.GameState client)
 {
     if (inPremium(client))
     {
         MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
         cmd.Update("premium").Set("VipDays", client.VIPDays).Set("VipStartDate", DateTime.Now.Ticks).Where("Username", client.Account.Username).Execute();
     }
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:8,代码来源:PremiumTable.cs

示例14: GetAddingsForItem

 public static void GetAddingsForItem(Interfaces.IConquerItem item)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("itemadding").Where("UID", item.UID);
     MySqlReader r = new MySqlReader(cmd);
     while (r.Read())
     {
         uint type = r.ReadUInt32("addingtype");
         if (type == 0)
         {
             ItemAdding.Purification_ purification = new ItemAdding.Purification_();
             purification.ItemUID = item.UID;
             purification.Available = true;
             purification.PurificationItemID = r.ReadUInt32("addingid");
             purification.PurificationDuration = r.ReadUInt32("duration");
             purification.PurificationLevel = r.ReadUInt32("addinglevel");
             purification.AddedOn = DateTime.FromBinary(r.ReadInt64("addedon"));
             if (purification.PurificationDuration != 0)
             {
                 TimeSpan span1 = new TimeSpan(purification.AddedOn.AddSeconds(purification.PurificationDuration).Ticks);
                 TimeSpan span2 = new TimeSpan(DateTime.Now.Ticks);
                 int secondsleft = (int)(span1.TotalSeconds - span2.TotalSeconds);
                 if (secondsleft <= 0)
                 {
                     purification.Available = false;
                     RemoveAdding(item.UID, purification.PurificationItemID);
                     continue;
                 }
             }
             item.Purification = purification;
         }
         else
         {
             ItemAdding.Refinery_ extraeffect = new ItemAdding.Refinery_();
             extraeffect.ItemUID = item.UID;
             extraeffect.Available = true;
             extraeffect.EffectID = r.ReadUInt32("addingid");
             extraeffect.EffectLevel = r.ReadUInt32("addinglevel");
             extraeffect.EffectPercent = r.ReadUInt32("addingpercent");
             extraeffect.EffectDuration = r.ReadUInt32("duration");
             extraeffect.AddedOn = DateTime.FromBinary(r.ReadInt64("addedon"));
             if (extraeffect.EffectDuration != 0)
             {
                 TimeSpan span1 = new TimeSpan(extraeffect.AddedOn.AddSeconds(extraeffect.EffectDuration).Ticks);
                 TimeSpan span2 = new TimeSpan(DateTime.Now.Ticks);
                 int secondsleft = (int)(span1.TotalSeconds - span2.TotalSeconds);
                 if (secondsleft <= 0)
                 {
                     extraeffect.Available = false;
                     RemoveAdding(item.UID, extraeffect.EffectID);
                     continue;
                 }
             }
             item.ExtraEffect = extraeffect;
         }
     }
     r.Close();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:58,代码来源:ItemAddingTable.cs

示例15: AddFriend

 public static void AddFriend(Client.GameState client, Friend friend)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
     cmd.Insert("friends").Insert("entityid", client.Entity.UID).Insert("friendid", friend.ID)
         .Insert("friendname", friend.Name).Execute();
     cmd = new MySqlCommand(MySqlCommandType.INSERT);
     cmd.Insert("friends").Insert("entityid", friend.ID).Insert("friendid", client.Entity.UID)
         .Insert("friendname", client.Entity.Name).Execute();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:9,代码来源:KnownPersons.cs


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