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


C# ServerMessage.AppendByte方法代码示例

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


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

示例1: ReadForumThread

        /// <summary>
        ///     Reads the forum thread.
        /// </summary>
        internal void ReadForumThread()
        {
            uint groupId = Request.GetUInteger();
            uint threadId = Request.GetUInteger();
            int startIndex = Request.GetInteger();

            Request.GetInteger();

            Group theGroup = Yupi.GetGame().GetGroupManager().GetGroup(groupId);

            if (theGroup == null || theGroup.Forum.Id == 0)
                return;

            using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(
                    $"SELECT * FROM groups_forums_posts WHERE group_id = '{groupId}' AND parent_id = '{threadId}' OR id = '{threadId}' ORDER BY timestamp ASC;");

                DataTable table = dbClient.GetTable();

                if (table == null)
                    return;

                int b = table.Rows.Count <= 20 ? table.Rows.Count : 20;

                List<GroupForumPost> posts = new List<GroupForumPost>();

                int i = 1;

                while (i <= b)
                {
                    DataRow row = table.Rows[i - 1];

                    if (row == null)
                    {
                        b--;
                        continue;
                    }

                    GroupForumPost thread = new GroupForumPost(row);

                    if (thread.ParentId == 0 && thread.Hidden)
                        return;

                    posts.Add(thread);

                    i++;
                }

                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumReadThreadMessageComposer"));

                message.AppendInteger(groupId);
                message.AppendInteger(threadId);
                message.AppendInteger(startIndex);
                message.AppendInteger(b);

                int indx = 0;

                foreach (GroupForumPost post in posts)
                {
                    message.AppendInteger(indx++ - 1);
                    message.AppendInteger(indx - 1);
                    message.AppendInteger(post.PosterId);
                    message.AppendString(post.PosterName);
                    message.AppendString(post.PosterLook);
                    message.AppendInteger(Yupi.GetUnixTimeStamp() - post.Timestamp);
                    message.AppendString(post.PostContent);
                    message.AppendByte(0);
                    message.AppendInteger(0);
                    message.AppendString(post.Hider);
                    message.AppendInteger(0);
                    message.AppendInteger(0);
                }

                Session.SendMessage(message);
            }
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:80,代码来源:Groups.cs

示例2: GetGroupForumThreadRoot

        /// <summary>
        ///     Gets the group forum thread root.
        /// </summary>
        internal void GetGroupForumThreadRoot()
        {
            uint groupId = Request.GetUInteger();
            int startIndex = Request.GetInteger();

            using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(
                    $"SELECT count(id) FROM groups_forums_posts WHERE group_id = '{groupId}' AND parent_id = 0");

                dbClient.GetInteger();

                dbClient.SetQuery(
                    $"SELECT * FROM groups_forums_posts WHERE group_id = '{groupId}' AND parent_id = 0 ORDER BY timestamp DESC, pinned DESC LIMIT @startIndex, @totalPerPage;");

                dbClient.AddParameter("startIndex", startIndex);
                dbClient.AddParameter("totalPerPage", TotalPerPage);

                DataTable table = dbClient.GetTable();
                int threadCount = table.Rows.Count <= TotalPerPage ? table.Rows.Count : TotalPerPage;

                List<GroupForumPost> threads = (from DataRow row in table.Rows select new GroupForumPost(row)).ToList();

                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumThreadRootMessageComposer"));
                message.AppendInteger(groupId);
                message.AppendInteger(startIndex);
                message.AppendInteger(threadCount);

                foreach (GroupForumPost thread in threads)
                {
                    message.AppendInteger(thread.Id);
                    message.AppendInteger(thread.PosterId);
                    message.AppendString(thread.PosterName);
                    message.AppendString(thread.Subject);
                    message.AppendBool(thread.Pinned);
                    message.AppendBool(thread.Locked);
                    message.AppendInteger(Yupi.GetUnixTimeStamp() - thread.Timestamp);
                    message.AppendInteger(thread.MessageCount + 1);
                    message.AppendInteger(0);
                    message.AppendInteger(0);
                    message.AppendInteger(0);
                    message.AppendString(string.Empty);
                    message.AppendInteger(Yupi.GetUnixTimeStamp() - thread.Timestamp);
                    message.AppendByte(thread.Hidden ? 10 : 1);
                    message.AppendInteger(0);
                    message.AppendString(thread.Hider);
                    message.AppendInteger(0);
                }

                Session.SendMessage(message);
            }
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:55,代码来源:Groups.cs

示例3: PublishForumThread

        /// <summary>
        ///     Publishes the forum thread.
        /// </summary>
        internal void PublishForumThread()
        {
            if (Yupi.GetUnixTimeStamp() - Session.GetHabbo().LastSqlQuery < 20)
                return;

            uint groupId = Request.GetUInteger();
            uint threadId = Request.GetUInteger();
            string subject = Request.GetString();
            string content = Request.GetString();

            Group group = Yupi.GetGame().GetGroupManager().GetGroup(groupId);

            if (group == null || group.Forum.Id == 0)
                return;

            int timestamp = Yupi.GetUnixTimeStamp();

            using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                if (threadId != 0)
                {
                    dbClient.SetQuery($"SELECT * FROM groups_forums_posts WHERE id = {threadId}");

                    DataRow row = dbClient.GetRow();
                    GroupForumPost post = new GroupForumPost(row);

                    if (post.Locked || post.Hidden)
                    {
                        Session.SendNotif(Yupi.GetLanguage().GetVar("forums_cancel"));
                        return;
                    }
                }

                Session.GetHabbo().LastSqlQuery = Yupi.GetUnixTimeStamp();
                dbClient.SetQuery(
                    "INSERT INTO groups_forums_posts (group_id, parent_id, timestamp, poster_id, poster_name, poster_look, subject, post_content) VALUES (@gid, @pard, @ts, @pid, @pnm, @plk, @subjc, @content)");
                dbClient.AddParameter("gid", groupId);
                dbClient.AddParameter("pard", threadId);
                dbClient.AddParameter("ts", timestamp);
                dbClient.AddParameter("pid", Session.GetHabbo().Id);
                dbClient.AddParameter("pnm", Session.GetHabbo().UserName);
                dbClient.AddParameter("plk", Session.GetHabbo().Look);
                dbClient.AddParameter("subjc", subject);
                dbClient.AddParameter("content", content);

                threadId = dbClient.GetUInteger();
            }

            group.Forum.ForumScore += 0.25;
            group.Forum.ForumLastPosterName = Session.GetHabbo().UserName;
            group.Forum.ForumLastPosterId = Session.GetHabbo().Id;
            group.Forum.ForumLastPosterTimestamp = (uint) timestamp;
            group.Forum.ForumMessagesCount++;
            group.UpdateForum();

            if (threadId == 0)
            {
                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumNewThreadMessageComposer"));
                message.AppendInteger(groupId);
                message.AppendInteger(threadId);
                message.AppendInteger(Session.GetHabbo().Id);
                message.AppendString(subject);
                message.AppendString(content);
                message.AppendBool(false);
                message.AppendBool(false);
                message.AppendInteger(Yupi.GetUnixTimeStamp() - timestamp);
                message.AppendInteger(1);
                message.AppendInteger(0);
                message.AppendInteger(0);
                message.AppendInteger(1);
                message.AppendString(string.Empty);
                message.AppendInteger(Yupi.GetUnixTimeStamp() - timestamp);
                message.AppendByte(1);
                message.AppendInteger(1);
                message.AppendString(string.Empty);
                message.AppendInteger(42);
                Session.SendMessage(message);
            }
            else
            {
                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumNewResponseMessageComposer"));
                message.AppendInteger(groupId);
                message.AppendInteger(threadId);
                message.AppendInteger(group.Forum.ForumMessagesCount);
                message.AppendInteger(0);
                message.AppendInteger(Session.GetHabbo().Id);
                message.AppendString(Session.GetHabbo().UserName);
                message.AppendString(Session.GetHabbo().Look);
                message.AppendInteger(Yupi.GetUnixTimeStamp() - timestamp);
                message.AppendString(content);
                message.AppendByte(0);
                message.AppendInteger(0);
                message.AppendString(string.Empty);
                message.AppendInteger(0);
                Session.SendMessage(message);
            }
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:100,代码来源:Groups.cs

示例4: AlterForumThreadState

        /// <summary>
        ///     Alters the state of the forum thread.
        /// </summary>
        internal void AlterForumThreadState()
        {
            uint groupId = Request.GetUInteger();
            uint threadId = Request.GetUInteger();
            int stateToSet = Request.GetInteger();

            using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(
                    $"SELECT * FROM groups_forums_posts WHERE group_id = '{groupId}' AND id = '{threadId}' LIMIT 1;");

                DataRow row = dbClient.GetRow();
                Group theGroup = Yupi.GetGame().GetGroupManager().GetGroup(groupId);

                if (row != null)
                {
                    if ((uint) row["poster_id"] == Session.GetHabbo().Id ||
                        theGroup.Admins.ContainsKey(Session.GetHabbo().Id))
                    {
                        dbClient.SetQuery($"UPDATE groups_forums_posts SET hidden = @hid WHERE id = {threadId};");
                        dbClient.AddParameter("hid", stateToSet == 20 ? "1" : "0");
                        dbClient.RunQuery();
                    }
                }

                GroupForumPost thread = new GroupForumPost(row);
                ServerMessage notif = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));

                notif.AppendString(stateToSet == 20 ? "forums.thread.hidden" : "forums.thread.restored");
                notif.AppendInteger(0);
                Session.SendMessage(notif);

                if (thread.ParentId != 0)
                    return;

                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumThreadUpdateMessageComposer"));
                message.AppendInteger(groupId);
                message.AppendInteger(thread.Id);
                message.AppendInteger(thread.PosterId);
                message.AppendString(thread.PosterName);
                message.AppendString(thread.Subject);
                message.AppendBool(thread.Pinned);
                message.AppendBool(thread.Locked);
                message.AppendInteger(Yupi.GetUnixTimeStamp() - thread.Timestamp);
                message.AppendInteger(thread.MessageCount + 1);
                message.AppendInteger(0);
                message.AppendInteger(0);
                message.AppendInteger(0);
                message.AppendString(string.Empty);
                message.AppendInteger(Yupi.GetUnixTimeStamp() - thread.Timestamp);
                message.AppendByte(stateToSet);
                message.AppendInteger(0);
                message.AppendString(thread.Hider);
                message.AppendInteger(0);

                Session.SendMessage(message);
            }
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:61,代码来源:Groups.cs

示例5: OnTrigger

        internal override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            if (Session != null)
                return;
            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            Point ItemCoordx1 = new Point(Item.Coordinate.X + 1, Item.Coordinate.Y);
            Point ItemCoordx2 = new Point(Item.Coordinate.X - 1, Item.Coordinate.Y);
            Point ItemCoordy1 = new Point(Item.Coordinate.X, Item.Coordinate.Y + 1);
            Point ItemCoordy2 = new Point(Item.Coordinate.X, Item.Coordinate.Y - 1);

            if (User == null)
            {
                return;
            }

            if (User.Coordinate != ItemCoordx1 && User.Coordinate != ItemCoordx2 && User.Coordinate != ItemCoordy1 && User.Coordinate != ItemCoordy2)
            {
                if (User.CanWalk)
                {
                    User.MoveTo(Item.SquareInFront);
                    return;
                }
            }
            else
            {
                int NewX = Item.Coordinate.X;
                int NewY = Item.Coordinate.Y;

                if (User.Coordinate == ItemCoordx1)
                {
                    NewX = Item.Coordinate.X - 1;
                    NewY = Item.Coordinate.Y;
                }
                else if (User.Coordinate == ItemCoordx2)
                {
                    NewX = Item.Coordinate.X + 1;
                    NewY = Item.Coordinate.Y;
                }
                else if (User.Coordinate == ItemCoordy1)
                {
                    NewX = Item.Coordinate.X;
                    NewY = Item.Coordinate.Y - 1;
                }
                else if (User.Coordinate == ItemCoordy2)
                {
                    NewX = Item.Coordinate.X;
                    NewY = Item.Coordinate.Y + 1;
                }

                if (Item.GetRoom().GetGameMap().ValidTile(NewX, NewY))
                {
                    Double NewZ = Item.GetRoom().GetGameMap().SqAbsoluteHeight(NewX, NewY);

                    ServerMessage Message = new ServerMessage(230);
                    Message.AppendInt32(Item.Coordinate.X);
                    Message.AppendInt32(Item.Coordinate.Y);
                    Message.AppendInt32(NewX);
                    Message.AppendInt32(NewY);
                    Message.AppendInt32(1);
                    Message.AppendUInt(Item.Id);
                    Message.AppendByte(2);
                    Message.AppendStringWithBreak(TextHandling.GetString(NewZ));
                    Message.AppendString("M");
                    Item.GetRoom().SendMessage(Message);

                    Item.GetRoom().GetRoomItemHandler().SetFloorItem(User.GetClient(), Item, NewX, NewY, Item.Rot, false, false, true);
                }
            }
        }
开发者ID:habb0,项目名称:Bfly,代码行数:70,代码来源:FurniInteractor.cs

示例6: OnTrigger


//.........这里部分代码省略.........
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(7);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actionteleportto:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendByte(2);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actionmoverotate:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendUInt(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendUInt(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(2);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(4);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                #endregion

                #region Add-ons
开发者ID:BjkGkh,项目名称:07052014,代码行数:67,代码来源:FurniInteractor.cs

示例7: UpdateThreadState

        /// <summary>
        /// Updates the state of the thread.
        /// </summary>
        internal void UpdateThreadState()
        {
            uint groupId = Request.GetUInteger();
            uint threadId = Request.GetUInteger();
            bool pin = Request.GetBool();
            bool Lock = Request.GetBool();

            using (IQueryAdapter dbClient = Azure.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery($"SELECT * FROM groups_forums_posts WHERE group_id = '{groupId}' AND id = '{threadId}' LIMIT 1;");
                DataRow row = dbClient.GetRow();

                Guild theGroup = Azure.GetGame().GetGroupManager().GetGroup(groupId);

                if (row != null)
                {
                    if ((uint)row["poster_id"] == Session.GetHabbo().Id || theGroup.Admins.ContainsKey(Session.GetHabbo().Id))
                    {
                        dbClient.SetQuery($"UPDATE groups_forums_posts SET pinned = @pin , locked = @lock WHERE id = {threadId};");
                        dbClient.AddParameter("pin", (pin) ? "1" : "0");
                        dbClient.AddParameter("lock", (Lock) ? "1" : "0");
                        dbClient.RunQuery();
                    }
                }

                var thread = new GroupForumPost(row);

                if (thread.Pinned != pin)
                {
                    var notif = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));

                    notif.AppendString((pin) ? "forums.thread.pinned" : "forums.thread.unpinned");
                    notif.AppendInteger(0);
                    Session.SendMessage(notif);
                }

                if (thread.Locked != Lock)
                {
                    var notif2 = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));

                    notif2.AppendString((Lock) ? "forums.thread.locked" : "forums.thread.unlocked");
                    notif2.AppendInteger(0);
                    Session.SendMessage(notif2);
                }

                if (thread.ParentId != 0)
                    return;

                var message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumThreadUpdateMessageComposer"));
                message.AppendInteger(groupId);
                message.AppendInteger(thread.Id);
                message.AppendInteger(thread.PosterId);
                message.AppendString(thread.PosterName);
                message.AppendString(thread.Subject);
                message.AppendBool(pin);
                message.AppendBool(Lock);
                message.AppendInteger((Azure.GetUnixTimeStamp() - thread.Timestamp));
                message.AppendInteger(thread.MessageCount + 1);
                message.AppendInteger(0);
                message.AppendInteger(0);
                message.AppendInteger(1);
                message.AppendString("");
                message.AppendInteger((Azure.GetUnixTimeStamp() - thread.Timestamp));
                message.AppendByte((thread.Hidden) ? 10 : 1);
                message.AppendInteger(1);
                message.AppendString(thread.Hider);
                message.AppendInteger(0);

                Session.SendMessage(message);
            }
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:74,代码来源:Groups.cs

示例8: ReadForumThread

        /// <summary>
        /// Reads the forum thread.
        /// </summary>
        internal void ReadForumThread()
        {
            int GroupId = Request.GetInteger();
            uint ThreadId = Request.GetUInteger();
            int StartIndex = Request.GetInteger();
            int EndIndex = Request.GetInteger();
            Guild Group = AzureEmulator.GetGame().GetGroupManager().GetGroup(GroupId);
            if (Group == null || !Group.HasForum)
                return;
            using (IQueryAdapter dbClient = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(string.Format("SELECT * FROM groups_forums_posts WHERE group_id = '{0}' AND parent_id = '{1}' OR id = '{2}' ORDER BY timestamp ASC;", GroupId, ThreadId, ThreadId));
                DataTable Table = dbClient.GetTable();
                if (Table == null)
                    return;
                int b = (Table.Rows.Count <= 20) ? Table.Rows.Count : 20;
                var posts = new List<GroupForumPost>();
                int i = 1;
                while (i <= b)
                {
                    DataRow Row = Table.Rows[i - 1];
                    if (Row == null)
                    {
                        b--;
                        continue;
                    }
                    var thread = new GroupForumPost(Row);
                    if (thread.ParentId == 0 && thread.Hidden)
                        return;
                    posts.Add(thread);
                    i++;
                }

                var Message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumReadThreadMessageComposer"));
                Message.AppendInteger(GroupId);
                Message.AppendInteger(ThreadId);
                Message.AppendInteger(StartIndex);
                Message.AppendInteger(b);
                int indx = 0;
                foreach (GroupForumPost Post in posts)
                {
                    Message.AppendInteger(indx++ - 1);
                    Message.AppendInteger(indx - 1);
                    Message.AppendInteger(Post.PosterId);
                    Message.AppendString(Post.PosterName);
                    Message.AppendString(Post.PosterLook);
                    Message.AppendInteger((AzureEmulator.GetUnixTimeStamp() - Post.Timestamp));
                    Message.AppendString(Post.PostContent);
                    Message.AppendByte(0);
                    Message.AppendInteger(0);
                    Message.AppendString(Post.Hider);
                    Message.AppendInteger(0);
                }
                Session.SendMessage(Message);
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:59,代码来源:Groups.cs

示例9: AlterForumThreadState

 /// <summary>
 /// Alters the state of the forum thread.
 /// </summary>
 internal void AlterForumThreadState()
 {
     int GroupId = Request.GetInteger();
     uint ThreadId = Request.GetUInteger();
     int StateToSet = Request.GetInteger();
     using (IQueryAdapter dbClient = AzureEmulator.GetDatabaseManager().GetQueryReactor())
     {
         dbClient.SetQuery(string.Format("SELECT * FROM groups_forums_posts WHERE group_id = '{0}' AND id = '{1}' LIMIT 1;", GroupId, ThreadId));
         DataRow Row = dbClient.GetRow();
         Guild Group = AzureEmulator.GetGame().GetGroupManager().GetGroup(GroupId);
         if (Row != null)
         {
             if ((uint)Row["poster_id"] == Session.GetHabbo().Id || Group.Admins.ContainsKey(Session.GetHabbo().Id))
             {
                 dbClient.SetQuery(string.Format("UPDATE groups_forums_posts SET hidden = @hid WHERE id = {0};", ThreadId));
                 dbClient.AddParameter("hid", (StateToSet == 10) ? "1" : "0");
                 dbClient.RunQuery();
             }
         }
         var Thread = new GroupForumPost(Row);
         var Notif = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));
         Notif.AppendString((StateToSet == 10) ? "forums.thread.hidden" : "forums.thread.restored");
         Notif.AppendInteger(0);
         Session.SendMessage(Notif);
         if (Thread.ParentId != 0)
             return;
         var Message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumThreadUpdateMessageComposer"));
         Message.AppendInteger(GroupId);
         Message.AppendInteger(Thread.Id);
         Message.AppendInteger(Thread.PosterId);
         Message.AppendString(Thread.PosterName);
         Message.AppendString(Thread.Subject);
         Message.AppendBool(Thread.Pinned);
         Message.AppendBool(Thread.Locked);
         Message.AppendInteger((AzureEmulator.GetUnixTimeStamp() - Thread.Timestamp));
         Message.AppendInteger(Thread.MessageCount + 1);
         Message.AppendInteger(0);
         Message.AppendInteger(0);
         Message.AppendInteger(0);
         Message.AppendString("");
         Message.AppendInteger((AzureEmulator.GetUnixTimeStamp() - Thread.Timestamp));
         Message.AppendByte(StateToSet);
         Message.AppendInteger(0);
         Message.AppendString(Thread.Hider);
         Message.AppendInteger(0);
         Session.SendMessage(Message);
     }
 }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:51,代码来源:Groups.cs

示例10: GetGroupForumThreadRoot

 /// <summary>
 /// Gets the group forum thread root.
 /// </summary>
 internal void GetGroupForumThreadRoot()
 {
     int GroupId = Request.GetInteger();
     int StartIndex = Request.GetInteger();
     int EndIndex = Request.GetInteger();
     Guild Group = AzureEmulator.GetGame().GetGroupManager().GetGroup(GroupId);
     if (Group == null || !Group.HasForum)
         return;
     using (IQueryAdapter dbClient = AzureEmulator.GetDatabaseManager().GetQueryReactor())
     {
         dbClient.SetQuery(string.Format("SELECT * FROM groups_forums_posts WHERE group_id = '{0}' AND parent_id = 0 ORDER BY timestamp DESC;", GroupId));
         DataTable Table = dbClient.GetTable();
         if (Table == null)
         {
             var Messages = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumThreadRootMessageComposer"));
             Messages.AppendInteger(GroupId);
             Messages.AppendInteger(0);
             Messages.AppendInteger(0);
             Session.SendMessage(Messages);
             return;
         }
         int b = (Table.Rows.Count <= 20) ? Table.Rows.Count : 20;
         var Threads = new List<GroupForumPost>();
         int i = 1;
         while (i <= b)
         {
             DataRow Row = Table.Rows[i - 1];
             if (Row == null)
             {
                 b--;
                 continue;
             }
             var thread = new GroupForumPost(Row);
             Threads.Add(thread);
             i++;
         }
         Threads = Threads.OrderByDescending(x => x.Pinned).ToList();
         var Message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumThreadRootMessageComposer"));
         Message.AppendInteger(GroupId);
         Message.AppendInteger(StartIndex);
         Message.AppendInteger(b);
         foreach (GroupForumPost Thread in Threads)
         {
             Message.AppendInteger(Thread.Id);
             Message.AppendInteger(Thread.PosterId);
             Message.AppendString(Thread.PosterName);
             Message.AppendString(Thread.Subject);
             Message.AppendBool(Thread.Pinned);
             Message.AppendBool(Thread.Locked);
             Message.AppendInteger((AzureEmulator.GetUnixTimeStamp() - Thread.Timestamp));
             Message.AppendInteger(Thread.MessageCount + 1);
             Message.AppendInteger(0);
             Message.AppendInteger(0);
             Message.AppendInteger(0);
             Message.AppendString("");
             Message.AppendInteger((AzureEmulator.GetUnixTimeStamp() - Thread.Timestamp));
             Message.AppendByte((Thread.Hidden) ? 10 : 1);
             Message.AppendInteger(0);
             Message.AppendString(Thread.Hider);
             Message.AppendInteger(0);
         }
         Session.SendMessage(Message);
     }
 }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:67,代码来源:Groups.cs


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