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


C# ClientMessage.PopString方法代码示例

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


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

示例1: AlertRoom

        private static void AlertRoom(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("moderation_tool"))
            {
                return;
            }

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("Could not send room alert."));
                return;
            }

            int Unknown1 = Message.PopWiredInt32();
            int AlertMode = Message.PopWiredInt32();
            string AlertMessage = Message.PopString();
            bool IsCaution = AlertMode != 3;

            Instance.SendModerationAlert(AlertMessage, IsCaution);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Sent room " + (IsCaution ? "caution" : "message"),
                    "Room " + Instance.Info.Name + " (ID " + Instance.RoomId + "): '" + AlertMessage + "'");
            }
        }
开发者ID:fuding,项目名称:Snowlight,代码行数:28,代码来源:ModerationHandler.cs

示例2: BanUser

        private static void BanUser(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("moderation_tool"))
            {
                return;
            }

            uint UserId = Message.PopWiredUInt32();
            string MessageText = Message.PopString();
            double Length = (Message.PopWiredInt32() * 3600);

            Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

            if (TargetSession == null || TargetSession.HasRight("moderation_tool"))
            {
                Session.SendData(NotificationMessageComposer.Compose("This user is not online or you do not have permission to ban them.\nPlease use housekeeping to ban users that are offline."));
                return;
            }

            SessionManager.StopSession(TargetSession.Id);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationBanManager.BanUser(MySqlClient, UserId, MessageText, Session.CharacterId, Length);
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Banned user",
                    "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ") for " +
                    Length + " hours: '" + MessageText + "'");
            }
        }
开发者ID:fuding,项目名称:Snowlight,代码行数:29,代码来源:ModerationHandler.cs

示例3: SsoLogin

        private static void SsoLogin(Session Session, ClientMessage Message)
        {
            if (Session.Authenticated)
            {
                return;
            }

            string Ticket = UserInputFilter.FilterString(Message.PopString());
            Session.TryAuthenticate(Ticket, Session.RemoteAddress.ToString());
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:10,代码来源:Handshake.cs

示例4: OnUserAgent

        private static void OnUserAgent(Session Session, ClientMessage Message)
        {
            string UserAgent = Message.PopString();

            if (UserAgent.Length > 2000)
            {
                UserAgent = UserAgent.Substring(0, 2000);
            }

            Session.UserAgent = UserAgent;
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:11,代码来源:Global.cs

示例5: UserWhisper

        private static void UserWhisper(Session Session, ClientMessage Message)
        {
            if (Session.CharacterInfo.IsMuted)
            {
                return;
            }

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            RoomActor Actor = Instance.GetActorByReferenceId(Session.CharacterId);

            if (Actor == null)
            {
                return;
            }

            string MessageText = UserInputFilter.FilterString(Message.PopString().Trim());

            if (MessageText.Length == 0)
            {
                return;
            }

            if (MessageText.Length > 100)
            {
                MessageText = MessageText.Substring(0, 100);
            }

            string[] Bits = MessageText.Split(' ');

            if (Bits.Length < 2)
            {
                return;
            }

            string UserBit = Bits[0];
            MessageText = MessageText.Substring(UserBit.Length + 1);

            uint UserId = CharacterResolverCache.GetUidFromName(UserBit);

            if (UserId > 0)
            {
                Actor.Whisper(MessageText, UserId);
            }
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:50,代码来源:RoomHandler.cs

示例6: GetPopularRooms

        private static void GetPopularRooms(Session Session, ClientMessage Message)
        {
            ServerMessage Response = TryGetResponseFromCache(0, Message);

            if (Response != null)
            {
                Session.SendData(Response);
                return;
            }

            int Category = -1;
            int.TryParse(Message.PopString(), out Category);

            IEnumerable<RoomInstance> Rooms =
                (from RoomInstance in RoomManager.RoomInstances
                 where RoomInstance.Value.Info.Type == RoomType.Flat &&
                    RoomInstance.Value.CachedNavigatorUserCount > 0 &&
                    (Category == -1 || RoomInstance.Value.Info.CategoryId == Category)
                 orderby RoomInstance.Value.CachedNavigatorUserCount descending
                 select RoomInstance.Value).Take(50);

            Response = NavigatorRoomListComposer.Compose(Category, 1, string.Empty, Rooms.ToList());
            AddToCacheIfNeeded(0, Message, Response);
            Session.SendData(Response);
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:25,代码来源:Navigator.cs

示例7: SetWardrobe

        private static void SetWardrobe(Session Session, ClientMessage Message)
        {
            int SlotAmount = GetWardrobeSlotAmountForSession(Session);
            int SlotId = Message.PopWiredInt32();
            string Figure = Message.PopString();
            CharacterGender Gender = (Message.PopString() == "M" ? CharacterGender.Male : CharacterGender.Female);

            if (SlotId <= 0 || SlotId > SlotAmount)
            {
                return;
            }

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                Session.CharacterInfo.SetWardrobeSlot(MySqlClient, SlotId, Figure, Gender);
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:17,代码来源:Inventory.cs

示例8: SetFigure

        private static void SetFigure(Session Session, ClientMessage Message)
        {
            // todo: verify data(!!!!)

            string NewGender = Message.PopString().ToLower();
            string NewFigure = UserInputFilter.FilterString(Message.PopString());

            if (NewGender != "m" && NewGender != "f")
            {
                NewGender = "m";
            }

            if (NewFigure.Length == 0 || (NewFigure == Session.CharacterInfo.Figure))
            {
                return;
            }

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                Session.CharacterInfo.UpdateFigure(MySqlClient, NewGender, NewFigure);
                AchievementManager.ProgressUserAchievement(MySqlClient, Session, "ACH_AvatarLooks", 1);
            }

            QuestManager.ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_LOOK);

            Session.SendInfoUpdate();
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:27,代码来源:Inventory.cs

示例9: MessageUser

        private static void MessageUser(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("moderation_tool"))
            {
                return;
            }

            uint UserId = Message.PopWiredUInt32();
            string MessageText = Message.PopString();

            Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

            if (TargetSession == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("That user is not online at this point in time."));
                return;
            }

            TargetSession.SendData(NotificationMessageComposer.Compose("Notification from staff:\n\n" + MessageText));
            ModerationTicketManager.MarkTicketRespondedToForUser(UserId);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Sent message to user",
                    "User " + TargetSession.CharacterInfo.Username + " (ID " + TargetSession.CharacterId + "): '" +
                    MessageText + "'.");
            }
        }
开发者ID:fuding,项目名称:Snowlight,代码行数:28,代码来源:ModerationHandler.cs

示例10: OnFriendRequest

        private static void OnFriendRequest(Session Session, ClientMessage Message)
        {
            string RequestName = UserInputFilter.FilterString(Message.PopString());
            uint TargetId = CharacterResolverCache.GetUidFromName(RequestName);

            if (TargetId < 1 || TargetId == Session.CharacterId)
            {
                return;
            }

            CharacterInfo TargetUserInfo = null;

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                TargetUserInfo = CharacterInfoLoader.GetCharacterInfo(MySqlClient, TargetId);

                if (!TargetUserInfo.PrivacyAcceptFriends)
                {
                    Session.SendData(MessengerErrorEvent.Compose(39, 3));
                    return;
                }

                if (FriendshipExists(MySqlClient, Session.CharacterId, TargetUserInfo.Id, false))
                {
                    return;
                }

                CreateFriendship(MySqlClient, Session.CharacterId, TargetUserInfo.Id, false);
            }

            Session NotifySession = SessionManager.GetSessionByCharacterId(TargetUserInfo.Id);

            if (NotifySession != null)
            {
                NotifySession.SendData(MessengerRequestNoficiationComposer.Compose(Session.CharacterId, Session.CharacterInfo.Username));
            }

            QuestManager.ProgressUserQuest(Session, QuestType.SOCIAL_FRIEND);
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:39,代码来源:MessengerHandler.cs

示例11: OpenFlatConnection

        private static void OpenFlatConnection(Session Session, ClientMessage Message)
        {
            uint RoomId = Message.PopWiredUInt32();
            string Password = Message.PopString();

            PrepareRoom(Session, RoomId, Password);
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:7,代码来源:RoomHandler.cs

示例12: OnCreateRoom

        private static void OnCreateRoom(Session Session, ClientMessage Message)
        {
            string Name = UserInputFilter.FilterString(Message.PopString());
            string ModelName = Message.PopString().ToLower();

            if (Name.Length < 3)
            {
                return;
            }

            RoomModel Model = RoomManager.GetModel(ModelName);

            if (Model == null || !Model.IsUsableBySession(Session) || Session.CharacterInfo.GetRoomCount() >= Navigator.MaxRoomsPerUser)
            {
                return;
            }

            uint RoomId = RoomManager.CreateRoom(Session.CharacterId, Name, ModelName);

            if (RoomId > 0)
            {
                Session.SendData(RoomCreateResultComposer.Compose(RoomId, Name));
            }
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:24,代码来源:RoomHandler.cs

示例13: IgnoreUser

        private static void IgnoreUser(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            uint UserId = CharacterResolverCache.GetUidFromName(Message.PopString());

            if (UserId == 0)
            {
                return;
            }

            Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

            if (TargetSession != null)
            {
                if (TargetSession.HasRight("cannot_ignore"))
                {
                    Session.SendData(NotificationMessageComposer.Compose("You can not ignore this user."));
                    return;
                }

                Session.IgnoreCache.MarkUserIgnored(TargetSession.CharacterId);
                Session.SendData(RoomIgnoreResultComposer.Compose(1));
            }
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:30,代码来源:RoomHandler.cs

示例14: EditRoom

        private static void EditRoom(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null || !Instance.CheckUserRights(Session, true))
            {
                return;
            }

            // [email protected]'s [email protected] is where I handle business. [email protected]@[email protected]@IbuttsechsAAAA

            uint Id = Message.PopWiredUInt32();

            if (Id != Instance.RoomId)
            {
                return;
            }

            string Name = UserInputFilter.FilterString(Message.PopString()).Trim();
            string Description = UserInputFilter.FilterString(Message.PopString()).Trim();
            RoomAccessType AccessType = (RoomAccessType)Message.PopWiredInt32();
            string Password = UserInputFilter.FilterString(Message.PopString()).Trim();
            int UserLimit = Message.PopWiredInt32();
            int CategoryId = Message.PopWiredInt32();
            int TagCount = Message.PopWiredInt32();

            List<string> Tags = new List<string>();

            for (int i = 0; (i < TagCount && i < 2); i++)
            {
                string Tag = UserInputFilter.FilterString(Message.PopString()).Trim().ToLower();

                if (Tag.Length > 32)
                {
                    Tag = Tag.Substring(0, 32);
                }

                if (Tag.Length > 0 && !Tags.Contains(Tag))
                {
                    Tags.Add(Tag);
                }
            }

            bool AllowPets = (Message.ReadBytes(1)[0] == 65);
            bool AllowPetEating = (Message.ReadBytes(1)[0] == 65);
            bool AllowBlocking = (Message.ReadBytes(1)[0] == 65);
            bool HideWalls = (Message.ReadBytes(1)[0] == 65);
            int WallThickness = Message.PopWiredInt32();
            int FloorThickness = Message.PopWiredInt32();

            if (WallThickness < -2 || WallThickness > 1)
            {
                WallThickness = 0;
            }

            if (FloorThickness < -2 || FloorThickness > 1)
            {
                FloorThickness = 0;
            }

            if (HideWalls && !Session.HasRight("club_vip"))
            {
                HideWalls = false;
            }

            if (Name.Length > 60) // was 25
            {
                Name = Name.Substring(0, 60);
            }

            if (Description.Length > 128)
            {
                Description = Description.Substring(0, 128);
            }

            if (Password.Length > 64)
            {
                Password = Password.Substring(0, 64);
            }

            if (UserLimit > Instance.Model.MaxUsers)
            {
                UserLimit = Instance.Model.MaxUsers;
            }

            if (Name.Length == 0)
            {
                Name = "Room";
            }

            if (AccessType == RoomAccessType.PasswordProtected && Password.Length == 0)
            {
                AccessType = RoomAccessType.Open;
            }

            Instance.Info.EditRoom(Name, Description, AccessType, Password, UserLimit, CategoryId, Tags, AllowPets,
                AllowPetEating, AllowBlocking, HideWalls, WallThickness, FloorThickness);

            Session.SendData(RoomUpdatedNotification1Composer.Compose(Instance.RoomId));
            Instance.BroadcastMessage(RoomUpdatedNotification2Composer.Compose(Instance.RoomId));
//.........这里部分代码省略.........
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:101,代码来源:RoomHandler.cs

示例15: CreateOrEditEvent

        private static void CreateOrEditEvent(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null || !Instance.CheckUserRights(Session, true) || Instance.Info.AccessType != RoomAccessType.Open)
            {
                return;
            }

            int CategoryId = Message.PopWiredInt32();
            string Name = UserInputFilter.FilterString(Message.PopString()).Trim();
            string Description = UserInputFilter.FilterString(Message.PopString()).Trim();
            int TagCount = Message.PopWiredInt32();
            List<string> Tags = new List<string>();

            for (int i = 0; (i < TagCount && i < 2); i++)
            {
                string Tag = UserInputFilter.FilterString(Message.PopString()).Trim().ToLower();

                if (Tag.Length > 25)
                {
                    Tag = Tag.Substring(0, 25);
                }

                if (Tag.Length > 0 && !Tags.Contains(Tag))
                {
                    Tags.Add(Tag);
                }
            }

            if (!Instance.HasOngoingEvent)
            {
                Session.MessengerFriendCache.BroadcastToFriends(MessengerFriendEventComposer.Compose(Session.CharacterId,
                    MessengerFriendEventType.EventStarted, Name));
            }

            Instance.StartOrUpdateEvent(Name, Description, CategoryId, Tags);
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:38,代码来源:RoomHandler.cs


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