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


C# MySqlCommand.Select方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: getVipInfo

 public static void getVipInfo(Client.GameState client)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("premium").Where("EntityName", client.Entity.Name);
     MySqlReader rdr = new MySqlReader(cmd);
     if (rdr.Read())
     {
         client.VIPDate = DateTime.FromBinary(rdr.ReadInt64("VipStartDate"));
         client.VIPDays = rdr.ReadUInt32("VipDays");
         rdr.Close();
     }
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:12,代码来源:PremiumTable.cs

示例5: Load

 public static void Load(Game.Entity Entity)
 {
     MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT);
     Command.Select("subclasses").Where("id", Entity.UID);
     MySqlReader Reader = new MySqlReader(Command);
     while (Reader.Read())
     {
         Game.SubClass Sub = new Game.SubClass();
         Sub.ID = Reader.ReadByte("uid");
         Sub.Level = Reader.ReadByte("level");
         Sub.Phase = Reader.ReadByte("phase");
         Entity.SubClasses.Classes.Add(Sub.ID, Sub);
     }
     Reader.Close();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:15,代码来源:SubClassTable.cs

示例6: ContainsArsenal

 public static bool ContainsArsenal(ushort gID)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("guild_arsenals").Where("guild_uid", gID).Execute();
     MySqlReader r = new MySqlReader(cmd);
     if (r.Read())
     {
         r.Close();
         return true;
     }
     else
     {
         r.Close();
         return false;
     }
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:16,代码来源:ArsenalsTable.cs

示例7: Load

 public static void Load()
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("HorseRace");
     MySqlReader reader = new MySqlReader(cmd);
     while (reader.Read())
     {
         Network.GamePackets.HorseRaceStatistic stat = new Network.GamePackets.HorseRaceStatistic(true);
         stat.Name = reader.ReadString("EntityName");
         stat.EntityID = reader.ReadUInt32("EntityID");
         stat.Rank = reader.ReadByte("Rank");
         stat.CurrentPts = reader.ReadUInt32("CurrentPts");
         Game.ConquerStructures.Society.HorseRace.HorseRaceStatistic.Add(stat.EntityID, stat);
     }
     reader.Close();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:16,代码来源:HorseRaceTable.cs

示例8: Load

 public static void Load()
 {
     MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
     command.Select("maps");
     MySqlReader reader = new MySqlReader(command);
     while (reader.Read())
     {
         MapInformation info = new MapInformation();
         info.ID = reader.ReadUInt16("id");
         info.BaseID = reader.ReadUInt16("mapdoc");
         info.Status = reader.ReadUInt32("type");
         info.Weather = reader.ReadUInt32("weather");
         MapInformations.Add(info.ID, info);
     }
     reader.Close();
     Console.WriteLine("Map informations loaded.");
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:17,代码来源:MapsTable.cs

示例9: Contains

        public static bool Contains(Game.Entity Entity, byte id)
        {
            bool Return = false;
            MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT);
            Command.Select("subclasses").Where("id", Entity.UID).And("uid", id);
            MySqlReader Reader = new MySqlReader(Command);
            if (Reader.Read())
            {
                if (Reader.ReadByte("uid") == id)
                {

                    Return = true;
                }
            }
            Reader.Close();
            return Return;
        }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:17,代码来源:SubClassTable.cs

示例10: getVp

 public static void getVp(Client.GameState client)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("premium").Where("EntityName", client.Entity.Name).Or("Username", client.Account.Username);
     MySqlReader rdr = new MySqlReader(cmd);
     if (rdr.Read())
     {
         client.VotePoints = rdr.ReadUInt32("VotePoint");
         rdr.Close();
     }
     else
     {
         client.VotePoints = 0;
         MySqlCommand Do = new MySqlCommand(MySqlCommandType.INSERT);
         Do.Insert("premium").Insert("EntityName", client.Entity.Name).Insert("Username", client.Account.Username).Insert("VotePoint", 0).Insert("IP", client.IP).Execute();
         rdr.Close();
     }
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:18,代码来源:PremiumTable.cs

示例11: Load

        public static void Load()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("arena");
            MySqlReader reader = new MySqlReader(cmd);
            while (reader.Read())
            {
                Network.GamePackets.ArenaStatistic stat = new Network.GamePackets.ArenaStatistic(true);
                stat.EntityID = reader.ReadUInt32("EntityID");
                stat.Name = reader.ReadString("EntityName");
                stat.LastSeasonRank = reader.ReadUInt32("LastSeasonRank");
                stat.LastSeasonArenaPoints = reader.ReadUInt32("LastSeasonArenaPoints");
                stat.ArenaPoints = reader.ReadUInt32("ArenaPoints");
                stat.TodayWin = reader.ReadByte("TodayWin");
                stat.TodayBattles = reader.ReadByte("TodayBattles"); // doesn't exist in the DB, removed it
                stat.LastSeasonWin = reader.ReadUInt32("LastSeasonWin");
                stat.LastSeasonLose = reader.ReadUInt32("LastSeasonLose");
                stat.TotalWin = reader.ReadUInt32("TotalWin");
                stat.TotalLose = reader.ReadUInt32("TotalLose");
                stat.HistoryHonor = reader.ReadUInt32("HistoryHonor");
                stat.CurrentHonor = reader.ReadUInt32("CurrentHonor");
                stat.Level = reader.ReadByte("Level");
                stat.Class = reader.ReadByte("Class");
                stat.Model = reader.ReadUInt32("Model");
                stat.LastArenaPointFill = DateTime.FromBinary(reader.ReadInt64("ArenaPointFill"));

                if (DateTime.Now.DayOfYear != stat.LastArenaPointFill.DayOfYear)
                {
                    stat.LastSeasonArenaPoints = stat.ArenaPoints;
                    stat.LastSeasonWin = stat.TodayWin;
                    stat.LastSeasonLose = stat.TodayBattles - stat.TodayWin;
                    stat.ArenaPoints = ArenaPointFill(stat.Level);
                    stat.LastArenaPointFill = DateTime.Now;
                    stat.TodayWin = 0;
                    stat.TodayBattles = 0;
                }

                Game.ConquerStructures.Arena.ArenaStatistics.Add(stat.EntityID, stat);
            }
            reader.Close();
            Game.ConquerStructures.Arena.Sort();
            Game.ConquerStructures.Arena.YesterdaySort();
            Console.WriteLine("Arena information loaded.");
        }
开发者ID:faresali,项目名称:co-pserver,代码行数:44,代码来源:ArenaTable.cs

示例12: LoadFlower

 public static void LoadFlower()
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("cq_flowers");
     MySqlReader r = new MySqlReader(cmd);
     while (r.Read())
     {
         Game.Struct.Flowers F = new Game.Struct.Flowers();
         F.Lilies = r.ReadInt32("lilies");
         F.Lilies2day = r.ReadInt32("liliestoday");
         F.Orchads = r.ReadInt32("orchads");
         F.Orchads2day = r.ReadInt32("orchadstoday");
         F.RedRoses = r.ReadInt32("redroses");
         F.RedRoses2day = r.ReadInt32("redrosestoday");
         F.Tulips = r.ReadInt32("tulips");
         F.Tulips2day = r.ReadInt32("tulipstoday");
         Conquer_Online_Server.ServerBase.Kernel.AllFlower.Add(r.ReadUInt32("charuid"), F);
     }
     r.Close();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:20,代码来源:LoadFlowers.cs

示例13: Load

 public static void Load()
 {
     MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
     command.Select("lottery");
     MySqlReader reader = new MySqlReader(command);
     while (reader.Read())
     {
         LotteryItem item = new LotteryItem();
         item.Rank = reader.ReadInt32("rank");
         item.Chance = reader.ReadInt32("chance");
         item.Name = reader.ReadString("prize_name");
         item.ID = reader.ReadUInt32("prize_item");
         item.Color = reader.ReadByte("color");
         item.Sockets = reader.ReadByte("hole_num");
         item.Plus = reader.ReadByte("addition_lev");
         LotteryItems.Add(item);
     }
     reader.Close();
     Console.WriteLine("Lottery items loaded.");
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:20,代码来源:LotteryTable.cs

示例14: GetSingleItem

 public static Interfaces.IConquerItem GetSingleItem(uint UID)
 {
     Interfaces.IConquerItem item = new Network.GamePackets.ConquerItem(true);
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("items").Where("UID", UID);
     MySqlReader r = new MySqlReader(cmd);
     if (r.Read())
     {
         item.ID = r.ReadUInt32("ID");
         item.UID = r.ReadUInt32("UID");
         item.Durability = r.ReadUInt16("Durability");
         item.MaximDurability = r.ReadUInt16("MaximDurability");
         item.Position = r.ReadUInt16("Position");
         item.SocketProgress = r.ReadUInt32("SocketProgress");
         item.PlusProgress = r.ReadUInt32("PlusProgress");
         item.SocketOne = (Game.Enums.Gem)r.ReadByte("SocketOne");
         item.SocketTwo = (Game.Enums.Gem)r.ReadByte("SocketTwo");
         item.Effect = (Game.Enums.ItemEffect)r.ReadByte("Effect");
         item.Mode = Game.Enums.ItemMode.Default;
         item.Plus = r.ReadByte("Plus");
         item.Bless = r.ReadByte("Bless");
         item.Bound = r.ReadBoolean("Bound");
         item.Enchant = r.ReadByte("Enchant");
         item.Lock = r.ReadByte("Locked");
         item.UnlockEnd = DateTime.FromBinary(r.ReadInt64("UnlockEnd"));
         item.Suspicious = r.ReadBoolean("Suspicious");
         item.RefineryPart = r.ReadUInt32("RefineryPart");
         item.RefineryLevel = r.ReadUInt32("RefineryLevel");
         item.RefineryPercent = r.ReadUInt16("RefineryPercent");
         item.RefineryStarted = DateTime.FromBinary(r.ReadInt64("RefineryStarted"));
         item.SuspiciousStart = DateTime.FromBinary(r.ReadInt64("SuspiciousStart"));
         item.Color = (Game.Enums.Color)r.ReadByte("Color");
         item.Warehouse = r.ReadUInt16("Warehouse");
         if (item.Lock == 2)
             if (DateTime.Now >= item.UnlockEnd)
                 item.Lock = 0;
     }
     r.Close();
     return item;
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:40,代码来源:ConquerItemTable.cs

示例15: CanVote

        public static bool CanVote(Client.GameState client)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("votes").Where("Username", client.Account.Username);
            MySqlReader rdr = new MySqlReader(cmd);
            if (rdr.Read())
            {
                string date = rdr.ReadString("ServerDate");
                date = date.Replace("-", "/");
                if (date.StartsWith("0") || date.Length < 4)
                    date = "2011/01/01 01:01:01";

                client.LastVote = ParseString(date);

                rdr.Close();
                if (DateTime.Now >= client.LastVote.AddHours(12))
                    return true;
                else
                    return false;
            }
            rdr.Close();
            return true;
        }
开发者ID:faresali,项目名称:co-pserver,代码行数:23,代码来源:VoteTable.cs


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