本文整理汇总了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();
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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();
}
示例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;
}
}
示例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();
}
示例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.");
}
示例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;
}
示例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();
}
}
示例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.");
}
示例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();
}
示例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.");
}
示例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;
}
示例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;
}