• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Core.SqlWrapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetGuildInfo

 /// <summary>
 /// 
 /// </summary>
 /// <param name="guildID"></param>
 /// <returns></returns>
 public static List<GuildEntry> GetGuildInfo(int guildID)
 {
     List<GuildEntry> Guild = new List<GuildEntry>();
     SqlWrapper ms = new SqlWrapper();
     string SqlQuery = "SELECT * FROM `organizations` WHERE ID=" + "'" + guildID + "'";
     DataTable dt = ms.ReadDatatable(SqlQuery);
     foreach (DataRow row in dt.Rows)
     {
         GuildEntry guildEntry = new GuildEntry();
         guildEntry.guildID = (UInt32) row["ID"];
         guildEntry.creation = (DateTime) row["creation"];
         guildEntry.Name = (string) row["Name"];
         guildEntry.LeaderID = (Int32) row["LeaderID"];
         guildEntry.GovernmentForm = (Int32) row["GovernmentForm"];
         guildEntry.Description = (string) row["Description"];
         guildEntry.Objective = (string) row["Objective"];
         guildEntry.History = (string) row["History"];
         guildEntry.Tax = (Int32) row["Tax"];
         guildEntry.Bank = (UInt64) row["Bank"];
         guildEntry.Comission = (Int32) row["Comission"];
         guildEntry.ContractsID = (Int32) row["ContractsID"];
         guildEntry.TowerFieldID = (Int32) row["TowerfieldID"];
         Guild.Add(guildEntry);
     }
     return Guild;
 }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:31,代码来源:GuildInfo.cs


示例2: Read

        /// <summary>
        /// Read and send back Player name lookup packet
        /// </summary>
        /// <param name="client">
        /// Client sending
        /// </param>
        /// <param name="packet">
        /// Packet data
        /// </param>
        public static void Read(Client client, byte[] packet)
        {
            PacketReader reader = new PacketReader(ref packet);

            reader.ReadUInt16(); // packet ID
            reader.ReadUInt16(); // data length
            uint playerId = uint.MaxValue;
            string playerName = reader.ReadString();
            client.Server.Debug(
                client, "{0} >> PlayerNameLookup: PlayerName: {1}", client.Character.characterName, playerName);
            reader.Finish();

            SqlWrapper ms = new SqlWrapper();
            string sqlQuery = "SELECT `ID` FROM `characters` WHERE `Name` = " + "'" + playerName + "'";
            DataTable dt = ms.ReadDatatable(sqlQuery);
            if (dt.Rows.Count > 0)
            {
                // Yes, this double cast is correct
                playerId = (uint)(int)dt.Rows[0][0];
            }

            byte[] namelookup = NameLookupResult.Create(playerId, playerName);
            client.Send(namelookup);
            client.KnownClients.Add(playerId);
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:34,代码来源:PlayerNameLookup.cs


示例3: GetOrgMembers

        /// <summary>
        /// </summary>
        /// <param name="orgId">
        /// </param>
        /// <param name="excludePresident">
        /// </param>
        /// <returns>
        /// </returns>
        public static List<int> GetOrgMembers(uint orgId, bool excludePresident)
        {
            // Stat #5 == Clan == OrgID
            // Stat #48 == ClanLevel == Org Rank (0 is president)
            SqlWrapper mySql = new SqlWrapper();
            List<int> orgMembers = new List<int>();
            string pres = string.Empty;

            if (excludePresident)
            {
                pres = " AND `ID` NOT IN (SELECT `ID` FROM `characters_stats` WHERE `Stat` = '48' AND `Value` = '0')";
            }

            DataTable dt =
                mySql.ReadDatatable(
                    "SELECT `ID` FROM `characters_stats` WHERE `Stat` = '5' AND `Value` = '" + orgId + "'" + pres);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    orgMembers.Add((Int32)row[0]);
                }
            }

            return orgMembers;
        }
开发者ID:Algorithman,项目名称:TestCellAO,代码行数:35,代码来源:CharacterStats.cs


示例4: CacheAllFromDB

        public static int CacheAllFromDB()
        {
            int c = 0;
            SqlWrapper ms = new SqlWrapper();
            DataTable dt = ms.ReadDatatable("SELECT * FROM doors");

            foreach (DataRow row in dt.Rows)
            {
                Doors door = new Doors();
                door.ID = (Int32)row["ID"];
                door.Coordinates.x = (Single)row["X"];
                door.Coordinates.y = (Single)row["Y"];
                door.Coordinates.z = (Single)row["Z"];
                door.hX = (Single)row["hx"];
                door.hY = (Single)row["hy"];
                door.hZ = (Single)row["hz"];
                door.hW = (Single)row["hw"];

                door.teleport_to_ID = (Int32)row["toid"];
                door.teleport_to_PlayField = (Int32)(UInt32)row["toplayfield"];
                door.proxy = (Boolean)row["proxy"];
                door.playfield = (Int32)(UInt32)row["playfield"];
                Program.zoneServer.Doors.Add(door);
                c++;
            }
            return c;
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:27,代码来源:DoorHandler.cs


示例5: LoadFromSQL

 // Load All Container Arrays from  SQL
 void LoadFromSQL(string tablename)
 {
     // Empty the Array first
     for (int i = 0; i < Items.Length; i++)
         Items[i] = null;
     SqlWrapper sql = new SqlWrapper();
     DataTable dt = sql.ReadDatatable("SELECT * FROM " + tablename + " WHERE container=" + Type + " AND ID=" + Instance);
     foreach (DataRow row in dt.Rows)
     {
         int place = (Int32)row["placement"];
         if (place < NumberOfSlots)
         {
             if (((Int32)row["type"] != 0) && ((Int32)row["instance"] != 0))
             {
                 // Do stuff with instanced items
                 // Create item from lowid/highid interpolated by QL and read stats from sql
             }
             else
             {
                 ContainerEntry ce = new ContainerEntry();
                 ce.LowID = (Int32)row["lowid"];
                 ce.HighID = (Int32)row["highid"];
                 ce.QL = (Int32)row["quality"];
                 ce.Amount = (Int32)row["multiplecount"];
                 ce.Flags = (uint)row["flags"];
                 ce.InstanceID = 0;
                 ce.Type = 0;
                 Items[place] = ce;
             }
         }
     }
 }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:33,代码来源:InventoryHandler.cs


示例6: LoadItems

        /// <summary>
        /// 
        /// </summary>
        /// <param name="charId"></param>
        /// <returns></returns>
        public static List<ItemsEntry> LoadItems(int charId)
        {
            List<ItemsEntry> items = new List<ItemsEntry>();
            SqlWrapper sqlWrapper = new SqlWrapper();
            try
            {
                string sqlQuery =
                    "SELECT `Placement`, `Flags`, `MultipleCount`, `Type`, `Instance`, `LowID`, `HighID`, `Quality`, `Nothing` FROM `inventory` WHERE ID = "
                    + "'" + charId + "' ORDER BY Placement ASC";
                DataTable dataTable = sqlWrapper.ReadDatatable(sqlQuery);

                foreach (DataRow itemRow in dataTable.Rows)
                {
                    ItemsEntry itemEntry = new ItemsEntry();
                    itemEntry.Placement = (Int32)itemRow["Placement"];
                    itemEntry.Flags = (Int16)itemRow["Flags"];
                    itemEntry.MultipleCount = (Int16)itemRow["MultipleCount"];
                    itemEntry.ItemType = (Int32)itemRow["Type"];
                    itemEntry.Instance = (Int32)itemRow["Instance"];
                    itemEntry.LowId = (Int32)itemRow["LowID"];
                    itemEntry.HighId = (Int32)itemRow["HighID"];
                    itemEntry.Quality = (Int32)itemRow["Quality"];
                    itemEntry.Nothing = (Int32)itemRow["Nothing"];

                    items.Add(itemEntry);
                }
            }
            catch (Exception e)
            {
                sqlWrapper.sqlclose();
                Console.WriteLine("Error: CharacterID: " + charId + "Message: " + e.Message);
            }
            return items;
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:39,代码来源:ItemsList.cs


示例7: writeOwnertoSql

        public void writeOwnertoSql()
        {
            SqlWrapper ms = new SqlWrapper();

            ms.SqlInsert(
                "INSERT INTO " + this.GetSqlTablefromDynelType() + "owner VALUES (" + this.Id.ToString() + ","
                + this.Owner.Id.ToString() + ")");
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:8,代码来源:Pet.cs


示例8: GetLoginPassword

        /// <summary>
        /// Returns the Password hash
        /// </summary>
        /// <param name="recvLogin">
        /// Username received from the client
        /// </param>
        public void GetLoginPassword(string recvLogin)
        {
            string sqlQuery = "SELECT `Password` FROM `login` WHERE `Username` = " + "'" + recvLogin + "'";
            SqlWrapper ms = new SqlWrapper();
            DataTable dt = ms.ReadDatatable(sqlQuery);

            foreach (DataRow row in dt.Rows)
            {
                this.passwdL = (string)row[0];
            }
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:17,代码来源:loginpasswd.cs


示例9: GetLoginName

        /// <summary>
        /// 
        /// </summary>
        /// <param name="recvLogin"></param>
        public void GetLoginName(string recvLogin)
        {
            string SqlQuery = "SELECT Username FROM login WHERE Username = " + "'" + recvLogin + "'";
            SqlWrapper ms = new SqlWrapper();
            DataTable dt = ms.ReadDatatable(SqlQuery);

            foreach (DataRow row in dt.Rows)
            {
                this.loginN = (string)row[0];
            }
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:15,代码来源:loginname.cs


示例10: GetLoginFlags

        /// <summary>
        /// Read login 
        /// </summary>
        /// <param name="recvLogin">
        /// Username sent by client
        /// </param>
        public void GetLoginFlags(string recvLogin)
        {
            string sqlQuery = "SELECT Flags FROM login WHERE Username = " + "'" + recvLogin + "'";
            SqlWrapper ms = new SqlWrapper();
            DataTable dt = ms.ReadDatatable(sqlQuery);

            foreach (DataRow row in dt.Rows)
            {
                this.flagsL = (Int32)row[0];
            }
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:17,代码来源:loginflags.cs


示例11: GetCharacterName

        /// <summary>
        /// Read name packet
        /// </summary>
        /// <param name="charId">
        /// The character Id.
        /// </param>
        /// <returns>
        /// The name of the character
        /// </returns>
        public string GetCharacterName(int charId)
        {
            string sqlQuery = string.Format("SELECT `Name` FROM `characters` WHERE `ID` = '{0}'", charId);
            SqlWrapper ms = new SqlWrapper();
            DataTable dt = ms.ReadDatatable(sqlQuery);
            if (dt.Rows.Count > 0)
            {
                this.name1 = (string)dt.Rows[0][0];
            }

            return this.name1;
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:21,代码来源:Misc.cs


示例12: GetCharacterZone

        /// <summary>
        /// 
        /// </summary>
        /// <param name="recvLogin"></param>
        public void GetCharacterZone(string recvLogin)
        {
            string sqlQuery = "SELECT `playfield` FROM `characters` WHERE Username = " + "'" + recvLogin + "'";
            SqlWrapper ms = new SqlWrapper();
            DataTable dt = ms.ReadDatatable(sqlQuery);

            foreach (DataRow datarow2 in dt.Rows)
            {
                this.playfield = (Int32)datarow2["playfield"];
                this.zone = BitConverter.GetBytes(this.playfield);
            }
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:16,代码来源:loginplayer.cs


示例13: UploadedNanos

        public static List<UploadedNanoEntry> UploadedNanos(int charId)
        {
            List<UploadedNanoEntry> uploadedNano = new List<UploadedNanoEntry>();
            SqlWrapper ms = new SqlWrapper();
            string sqlQuery = "SELECT `NanoProgramID` FROM `uploadednanos` WHERE CharID = " + "'" + charId + "'";
            DataTable dt = ms.ReadDatatable(sqlQuery);

            foreach (DataRow nanoRow in dt.Rows)
            {
                uploadedNano.Add(new UploadedNanoEntry { NanoProgramId = (Int32)nanoRow["NanoProgramID"] });
            }
            return uploadedNano;
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:13,代码来源:UploadedNanoList.cs


示例14: readOwnerfromSql

        public void readOwnerfromSql()
        {
            SqlWrapper ms = new SqlWrapper();

            DataTable dt =
                ms.ReadDatatable(
                    "SELECT * FROM " + this.GetSqlTablefromDynelType() + "owner WHERE ID=" + this.Id.ToString());
            if (dt.Rows.Count > 0)
            {
                //TODO: Add Pet code here
                // Owner = FindCharacterByID(ms.myreader.GetInt32("owner");
            }
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:13,代码来源:Pet.cs


示例15: LoadRecentMsgsList

        // LoadRecentMsgsList unused?

        /// <summary>
        /// The load recent msgs list.
        /// </summary>
        /// <param name="charId">
        /// The char Id.
        /// </param>
        /// <returns>
        /// List of received messages
        /// </returns>
        public static Collection<RecentMsgsEntry> LoadRecentMsgsList(uint charId)
        {
            Collection<RecentMsgsEntry> reciviedMsgsList = new Collection<RecentMsgsEntry>();
            SqlWrapper ms = new SqlWrapper();
            string sqlQuery = "SELECT `ReceivedID` FROM `receivedmsgs` WHERE PlayerID =" + "'" + charId + "'";
            DataTable dt = ms.ReadDatatable(sqlQuery);
            foreach (DataRow msgsRow in dt.Rows)
            {
                RecentMsgsEntry rme = new RecentMsgsEntry { ReceivedId = uint.Parse(msgsRow["ReceivedID"].ToString()) };
                reciviedMsgsList.Add(rme);
            }

            return reciviedMsgsList;
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:25,代码来源:BuddyList.cs


示例16: IsOnline

 public static bool IsOnline(int id)
 {
     SqlWrapper sql = new SqlWrapper();
     DataTable dt = sql.ReadDatatable("SELECT * FROM characters WHERE ID = " + id + ";");
     if (dt.Rows.Count == 0)
     {
         throw new CharacterDoesNotExistException("Character does not exist: " + id);
     }
     if ((Int16)dt.Rows[0]["Online"] == 1)
     {
         return true;
     }
     return false;
 }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:14,代码来源:OnlineChars.cs


示例17: readWaypointsfromSQL

        public void readWaypointsfromSQL()
        {
            SqlWrapper ms = new SqlWrapper();
            AOCoord m_wp;

            DataTable dt = ms.ReadDT("SELECT * FROM " + getSQLTablefromDynelType() + "waypoints WHERE ID=" + ID.ToString());

            foreach (DataRow row in dt.Rows)
            {
                m_wp = new AOCoord((Single)row["X"], (Single)row["Y"], (Single)row["Z"]);
                Waypoints.Add(m_wp);
            }
             
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:14,代码来源:NonPC.cs


示例18: LoadBuddyList

        /// <summary>
        /// The load buddy list.
        /// </summary>
        /// <param name="charId">
        /// The char Id.
        /// </param>
        /// <returns>
        /// Buddy list
        /// </returns>
        public static Collection<BuddyListEntry> LoadBuddyList(int charId)
        {
            Collection<BuddyListEntry> buddyList = new Collection<BuddyListEntry>();
            SqlWrapper ms = new SqlWrapper();
            string sqlQuery = "SELECT `BuddyID` FROM `buddylist` WHERE PlayerID = " + "'" + charId + "'";
            DataTable dt = ms.ReadDatatable(sqlQuery);

            foreach (DataRow buddyRow in dt.Rows)
            {
                BuddyListEntry buddylistentry = new BuddyListEntry();
                buddylistentry.BuddyId = uint.Parse(buddyRow["BuddyID"].ToString());
                buddyList.Add(buddylistentry);
            }

            return buddyList;
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:25,代码来源:BuddyList.cs


示例19: GetCharacterName

        /// <summary>
        /// 
        /// </summary>
        /// <param name="recvLogin"></param>
        public void GetCharacterName(string recvLogin)
        {
            string sqlQuery = "SELECT `Name`, `Breed`, `Profession` FROM `characters` WHERE Username = " + "'"
                              + recvLogin + "'";
            SqlWrapper ms = new SqlWrapper();
            DataTable dt = ms.ReadDatatable(sqlQuery);

            foreach (DataRow datarow1 in dt.Rows)
            {
                this.name = Encoding.ASCII.GetBytes(datarow1["Name"].ToString().PadRight(11, '\u0000'));
                this.cbreedint = int.Parse(datarow1["Breed"].ToString());
                this.breed = BitConverter.GetBytes(this.cbreedint);
                this.cprofint = int.Parse(datarow1["Profession"].ToString());
                this.prof = BitConverter.GetBytes(this.cprofint);
            }
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:20,代码来源:loginplayer.cs


示例20: writeWaypointstoSQL

        public void writeWaypointstoSQL()
        {
            SqlWrapper ms = new SqlWrapper();
            int count;

            ms.SqlDelete("DELETE FROM "+getSQLTablefromDynelType()+"waypoints WHERE ID="+ID.ToString());

            for (count = 0; count < Waypoints.Count; count++)
            {
                ms.SqlInsert("INSERT INTO " + getSQLTablefromDynelType() + "waypoints VALUES (" + ID.ToString() + "," + PlayField.ToString() + ","
                    + String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Waypoints[count].x) + ","
                    + String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Waypoints[count].y) + ","
                    + String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}'", Waypoints[count].z) + ")");
            }
            if (Waypoints.Count > 0) { }
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:16,代码来源:NonPC.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TextDocuments.TextDocument类代码示例发布时间:2022-05-24
下一篇:
C# AIMLbot.Request类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap