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

C# Storage.SqlDatabaseClient类代码示例

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

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



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

示例1: ReloadCache

        public static void ReloadCache(SqlDatabaseClient MySqlClient)
        {
            lock (mSyncRoot)
            {
                mCharacterBlacklist.Clear();
                mRemoteAddressBlacklist.Clear();

                MySqlClient.SetParameter("timestamp", UnixTimestamp.GetCurrent());
                DataTable Table = MySqlClient.ExecuteQueryTable("SELECT * FROM bans WHERE timestamp_expire > @timestamp");

                foreach (DataRow Row in Table.Rows)
                {
                    uint UserId = (uint)Row["user_id"];
                    string RemoteAddr = (string)Row["remote_address"];

                    if (UserId > 0 && !mCharacterBlacklist.Contains(UserId))
                    {
                        mCharacterBlacklist.Add(UserId);
                    }

                    if (RemoteAddr.Length > 0 && !mRemoteAddressBlacklist.Contains(RemoteAddr))
                    {
                        mRemoteAddressBlacklist.Add(RemoteAddr);
                    }
                }
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:27,代码来源:ModerationBanManager.cs


示例2: FavoriteRoomsCache

        public FavoriteRoomsCache(SqlDatabaseClient MySqlClient, uint CharacterId)
        {
            mCharacterId = CharacterId;
            mInner = new List<uint>();

            ReloadCache(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:7,代码来源:FavoriteRoomCache.cs


示例3: ReloadRewards

        public static void ReloadRewards(SqlDatabaseClient MySqlClient)
        {
            lock (mSyncRoot)
            {
                DataTable Table = MySqlClient.ExecuteQueryTable("SELECT * FROM recycler_rewards");

                int UniqueLevels = 0;

                foreach (DataRow Row in Table.Rows)
                {
                    int RewardLevel = (int)Row["chance_level"];

                    if (!mRewards.ContainsKey(RewardLevel))
                    {
                        mRewards.Add(RewardLevel, new List<uint>());
                        UniqueLevels++;
                    }

                    mRewards[RewardLevel].Add((uint)Row["item_id"]);
                }

                if (UniqueLevels != 5)
                {
                    Output.WriteLine("Recycler is not configured correctly and will *not* work properly. Please ensure there are 5 unique reward levels.", OutputLevel.Warning);
                    mEnabled = false;
                }
                else
                {
                    mEnabled = true;
                }
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:32,代码来源:RecyclerManager.cs


示例4: InventoryCache

        public InventoryCache(SqlDatabaseClient MySqlClient, uint CharacterId)
        {
            mCharacterId = CharacterId;
            mInner = new Dictionary<uint, Item>();

            ReloadCache(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:7,代码来源:InventoryCache.cs


示例5: Initialize

        public static void Initialize(SqlDatabaseClient MySqlClient)
        {
            mBadges = new Dictionary<uint, Badge>();
            mRightSets = new Dictionary<uint,List<string>>();

            RebuildCache(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:7,代码来源:RightsManager.cs


示例6: GetCharacterInfo

        public static CharacterInfo GetCharacterInfo(SqlDatabaseClient MySqlClient, uint CharacterId, uint LinkedClientId, bool IgnoreCache)
        {
            if (SessionManager.ContainsCharacterId(CharacterId))
            {
                Session Session = SessionManager.GetSessionByCharacterId(CharacterId);
                return Session.CharacterInfo;
            }

            if (!IgnoreCache)
            {
                CharacterInfo CachedInfo = TryGetInfoFromCache(CharacterId);

                if (CachedInfo != null)
                {
                    return CachedInfo;
                }
            }

            MySqlClient.SetParameter("id", CharacterId);
            DataRow Row = MySqlClient.ExecuteQueryRow("SELECT * FROM characters WHERE id = @id LIMIT 1");

            if (Row != null)
            {
                return GenerateCharacterInfoFromRow(MySqlClient, LinkedClientId, Row);
            }

            return null;
        }
开发者ID:anthony93260,项目名称:Snowlight,代码行数:28,代码来源:CharacterInfoLoader.cs


示例7: CharacterInfo

        public CharacterInfo(SqlDatabaseClient MySqlClient, uint SessionId, uint Id, string Username, string RealName, string Figure, 
            CharacterGender Gender, string Motto, int Credits, int ActivityPoints, double ActivityPointsLastUpdate,
            bool PrivacyAcceptFriends, uint HomeRoom, int Score, int ConfigVolume, int ModerationTickets,
            int ModerationTicketsAbusive, double ModerationTicketCooldown, int ModerationBans, int ModerationCautions,
            double TimestampLastOnline, double TimestampRegistered, int RespectPoints, int RespectCreditHuman,
            int RespectCreditPets, double ModerationMutedUntil)
        {
            mSessionId = SessionId;
            mId = Id;
            mUsername = Username;
            mRealName = RealName;
            mFigure = Figure;
            mGender = Gender;
            mMotto = Motto;
            mCredits = Credits;

            mActivityPoints = ActivityPoints;
            mPrivacyAcceptFriends = PrivacyAcceptFriends;
            mHomeRoom = HomeRoom;
            mScore = Score;
            mConfigVolume = ConfigVolume;

            mRespectPoints = RespectPoints;
            mRespectCreditHuman = RespectCreditHuman;
            mRespectCreditPets = RespectCreditPets;

            mModerationTickets = ModerationTickets;
            mModerationTicketsAbusive = ModerationTicketsAbusive;
            mModerationTicketsCooldown = ModerationTicketCooldown;
            mModerationCautions = ModerationCautions;
            mModerationBans = ModerationBans;
            mModerationMutedUntil = ModerationMutedUntil;

            mCacheAge = UnixTimestamp.GetCurrent();
            mTimestampLastActivityPointsUpdate = ActivityPointsLastUpdate;
            mTimestampLastOnline = TimestampLastOnline;
            mTimestampRegistered = TimestampRegistered;

            mWardrobe = new Dictionary<int, WardrobeItem>();
            mTags = new List<string>();

            if (MySqlClient != null)
            {
                MySqlClient.SetParameter("userid", mId);
                DataTable Table = MySqlClient.ExecuteQueryTable("SELECT * FROM wardrobe WHERE user_id = @userid LIMIT 10");

                foreach (DataRow Row in Table.Rows)
                {
                    mWardrobe.Add((int)Row["slot_id"], new WardrobeItem((string)Row["figure"], (Row["gender"].ToString().ToLower() == "m" ? CharacterGender.Male : CharacterGender.Female)));
                }

                MySqlClient.SetParameter("userid", mId);
                DataTable TagsTable = MySqlClient.ExecuteQueryTable("SELECT * FROM tags WHERE user_id = @userid");

                foreach (DataRow Row in TagsTable.Rows)
                {
                    mTags.Add((string)Row["tag"]);
                }
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:60,代码来源:CharacterInfo.cs


示例8: Initialize

        public static void Initialize(SqlDatabaseClient MySqlClient)
        {
            mSets = new Dictionary<int, DrinkSet>();

            DataTable Table = MySqlClient.ExecuteQueryTable("SELECT * FROM drink_sets");

            foreach (DataRow Row in Table.Rows)
            {
                int Id = (int)Row["id"];
                string[] DrinkData = Row["drinks"].ToString().Split(',');

                List<int> Drinks = new List<int>();

                foreach (string Drink in DrinkData)
                {
                    int i = 0;
                    int.TryParse(Drink, out i);

                    if (i > 0)
                    {
                        Drinks.Add(i);
                    }
                }

                if (Drinks.Count > 0)
                {
                    mSets.Add(Id, new DrinkSet(Id, Drinks));
                }
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:30,代码来源:DrinkSetManager.cs


示例9: FriendshipExists

        public static bool FriendshipExists(SqlDatabaseClient MySqlClient, uint UserId1, uint UserId2, bool ConfirmedOnly)
        {
            MySqlClient.SetParameter("user1", UserId1);
            MySqlClient.SetParameter("user2", UserId2);
            MySqlClient.SetParameter("confirmed", (ConfirmedOnly ? 0 : 2));

            return (MySqlClient.ExecuteQueryRow("SELECT null FROM messenger_friendships WHERE user_1_id = @user1 AND user_2_id = @user2 AND confirmed != @confirmed OR user_2_id = @user1 AND user_1_id = @user2 AND confirmed != @confirmed LIMIT 1") != null);
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:8,代码来源:MessengerHandler.cs


示例10: NewItemsCache

        public NewItemsCache(SqlDatabaseClient MySqlClient, uint UserId)
        {
            mUserId = UserId;
            mInner = new Dictionary<int, List<uint>>();
            mSyncRoot = new object();

            ReloadCache(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:8,代码来源:NewItemsCache.cs


示例11: Initialize

        public static void Initialize(SqlDatabaseClient MySqlClient)
        {
            mRaces = new Dictionary<int, List<PetRaceData>>();
            mTricks = new Dictionary<int, List<string>>();
            mSyncRoot = new object();

            ReloadData(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:8,代码来源:PetDataManager.cs


示例12: PetInventoryCache

        public PetInventoryCache(SqlDatabaseClient MySqlClient, uint CharacterId)
        {
            mCharacterId = CharacterId;
            mInner = new Dictionary<uint, Pet>();
            mSyncRoot = new object();

            ReloadCache(MySqlClient);
        }
开发者ID:fuding,项目名称:Snowlight,代码行数:8,代码来源:PetInventoryCache.cs


示例13: QuestCache

        public QuestCache(SqlDatabaseClient MySqlClient, uint UserId)
        {
            mUserId = UserId;
            mInner = new Dictionary<uint, int>();
            mSyncRoot = new object();

            ReloadCache(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:8,代码来源:QuestCache.cs


示例14: SessionMessengerFriendCache

        public SessionMessengerFriendCache(SqlDatabaseClient MySqlClient, uint UserId)
        {
            mCharacterId = UserId;
            mInner = new List<uint>();
            mInnerUpdates = new Dictionary<uint, int>();

            ReloadCache(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:8,代码来源:SessionMessengerCache.cs


示例15: AchievementCache

        public AchievementCache(SqlDatabaseClient MySqlClient, uint UserId)
        {
            mUserId = UserId;
            mInner = new Dictionary<string, UserAchievement>();
            mSyncRoot = new object();

            ReloadCache(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:8,代码来源:AchievementCache.cs


示例16: UserIgnoreCache

        public UserIgnoreCache(SqlDatabaseClient MySqlClient, uint UserId)
        {
            mUserId = UserId;
            mInner = new List<uint>();
            mSyncRoot = new object();

            ReloadCache(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:8,代码来源:UserIgnoreCache.cs


示例17: Initialize

        public static void Initialize(SqlDatabaseClient MySqlClient)
        {
            mUserMessagePresets = new List<string>();
            mRoomMessagePresets = new List<string>();
            mUserActionPresetCategories = new Dictionary<uint, string>();
            mUserActionPresetMessages = new Dictionary<uint, Dictionary<string, string>>();

            Reload(MySqlClient);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:9,代码来源:ModerationPresets.cs


示例18: Initialize

        public static void Initialize(SqlDatabaseClient MySqlClient)
        {
            mAchievements = new Dictionary<string, Achievement>();
            mSyncRoot = new object();

            ReloadAchievements(MySqlClient);

            DataRouter.RegisterHandler(OpcodesIn.ACHIEVEMENTS_GET_LIST, new ProcessRequestCallback(GetList));
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:9,代码来源:AchievementManager.cs


示例19: Reload

        public static void Reload(SqlDatabaseClient MySqlClient)
        {
            int i = 0;

            mUserMessagePresets.Clear();
            mRoomMessagePresets.Clear();
            mUserActionPresetCategories.Clear();
            mUserActionPresetMessages.Clear();

            DataTable BasicPresetTable = MySqlClient.ExecuteQueryTable("SELECT type,message FROM moderation_presets");

            foreach (DataRow Row in BasicPresetTable.Rows)
            {
                string Message = (string)Row["message"];

                switch ((string)Row["type"])
                {
                    case "room":

                        mRoomMessagePresets.Add(Message);
                        break;

                    case "user":

                        mUserMessagePresets.Add(Message);
                        break;
                }

                i++;
            }

            DataTable UserActionCategoryTable = MySqlClient.ExecuteQueryTable("SELECT id,caption FROM moderation_preset_action_categories");

            foreach (DataRow Row in UserActionCategoryTable.Rows)
            {
                mUserActionPresetCategories.Add((uint)Row["id"], (string)Row["caption"]);
                i++;
            }

            DataTable UserActionMsgTable = MySqlClient.ExecuteQueryTable("SELECT id,parent_id,caption,message_text FROM moderation_preset_action_messages");

            foreach (DataRow Row in UserActionMsgTable.Rows)
            {
                uint ParentId = (uint)Row["parent_id"];

                if (!mUserActionPresetMessages.ContainsKey(ParentId))
                {
                    mUserActionPresetMessages.Add(ParentId, new Dictionary<string, string>());
                }

                mUserActionPresetMessages[ParentId].Add((string)Row["caption"], (string)Row["message_text"]);
                i++;
            }

            Output.WriteLine("Loaded " + i + " moderation categories and presets.", OutputLevel.DebugInformation);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:56,代码来源:ModerationPresets.cs


示例20: Initialize

        public static void Initialize(SqlDatabaseClient MySqlClient)
        {
            mCharacterBlacklist = new List<uint>();
            mRemoteAddressBlacklist = new List<string>();
            mSyncRoot = new object();

            mWorker = new Timer(new TimerCallback(ProcessThread), null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));

            ReloadCache(MySqlClient);
        }
开发者ID:rayooh,项目名称:Snowlight,代码行数:10,代码来源:ModerationBanManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SoG.AttackCollisionData类代码示例发布时间:2022-05-26
下一篇:
C# Sessions.Session类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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