Esempio n. 1
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(257)
                .AppendInt32(A)
                .AppendInt32(B)
                .AppendInt32(C)
                .AppendInt32(D)
                .AppendInt32(E)
                .AppendInt32(F)
                .AppendInt32(G)
                .AppendInt32(H)
                .AppendInt32(I)
                .AppendInt32(J)
                .AppendInt32(K)
                .AppendInt32(L)
                .AppendString(DateFormat)
                .AppendString(M)
                .AppendInt32(N)
                .AppendBoolean(O)
                .AppendInt32(P)
                .AppendString(URL)
                .AppendString(Q)
                .AppendInt32(R)
                .AppendBoolean(S);
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 2
0
 public OutgoingMessage Send(IMessageable target)
 {
     Compile();
     if (!InternalOutgoingMessage.IsCompiled)
         InternalOutgoingMessage.Compile();
     target.SendMessage(InternalOutgoingMessage);
     return this;
 }
        void RunChat(IMessageable messenger)
        {
            string        input;    // the input to use in input mode
            List <string> messages; // store messages from client

            while (true)
            {
                // show any newly recieved messages from client
                messenger.CheckForMessages();
                messages = messenger.Messages;
                if (messages.Count > 0)
                {
                    foreach (string message in messages)
                    {
                        Console.WriteLine(message);
                    }
                }

                // keep looping until I is pressed
                // learned from: http://stackoverflow.com/questions/5891538/listen-for-key-press-in-net-console-app
                do
                {
                    // keep in this loop while there is no key pressed
                    while (!Console.KeyAvailable)
                    {
                        // update the text from client if there is any new
                        messenger.CheckForMessages();
                        messages = messenger.Messages;
                        if (messages.Count > 0)
                        {
                            foreach (string message in messages)
                            {
                                Console.WriteLine(message);
                            }
                        }
                    }
                }
                // stop when I is pressed
                while (Console.ReadKey(true).Key != ConsoleKey.I);

                // I was pressed now await user input
                Console.Write(">> ");
                input = Console.ReadLine();

                // quit if input = 'quit'
                if (input.Equals("quit"))
                {
                    // do stuff to quit
                    messenger.Disconnect();
                    return;
                }
                // send message if input is not blank
                else if (!input.Equals(""))
                {
                    messenger.WriteMessage(input);
                }
            }
        }
 public override OutgoingMessage Send(IMessageable target)
 {
     if (InternalOutgoingMessage.ID == 0)
     {
         InternalOutgoingMessage.Initialize(3);
     }
     target.SendMessage(InternalOutgoingMessage);
     return(this);
 }
Esempio n. 5
0
 public OutgoingMessage Send(IMessageable target)
 {
     Compile();
     if (!InternalOutgoingMessage.IsCompiled)
     {
         InternalOutgoingMessage.Compile();
     }
     target.SendMessage(InternalOutgoingMessage);
     return(this);
 }
Esempio n. 6
0
 public override OutgoingMessage Send(IMessageable target)
 {
     if (InternalOutgoingMessage.Id == 0)
     {
         InternalOutgoingMessage.Initialize(277)
             .AppendBoolean(UnknownA);
     }
     target.SendMessage(InternalOutgoingMessage);
     return this;
 }
Esempio n. 7
0
 public override OutgoingMessage Send(IMessageable target)
 {
     if (InternalOutgoingMessage.ID == 0)
     {
         InternalOutgoingMessage.Initialize(277)
         .AppendBoolean(UnknownA);
     }
     target.SendMessage(InternalOutgoingMessage);
     return(this);
 }
Esempio n. 8
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(287)
                    .AppendInt32((int)Reason);
            }

            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 9
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(6)
                    .AppendString(Balance.ToString(CultureInfo.InvariantCulture));
            }

            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 10
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(308).
                    AppendInt32(Volume);
            }

            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 11
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(6)
                .AppendString(Balance.ToString(CultureInfo.InvariantCulture));
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 12
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(287)
                .AppendInt32((int)Reason);
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 13
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(308).
                AppendInt32(Volume);
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 14
0
        internal Chatter RegistChatter(IMessageable messageable)
        {
            var chatter = new Chatter(messageable, (msg) => _Broadcast(msg, messageable));

            lock (_Chatters)
            {
                _Chatters.Add(chatter);
            }

            return(chatter);
        }
Esempio n. 15
0
 public override OutgoingMessage Send(IMessageable target)
 {
     if (InternalOutgoingMessage.ID == 0)
     {
         InternalOutgoingMessage.Initialize(132)
         .AppendInt32(ID)
         .AppendString(Username)
         .AppendString(ID.ToString());
     }
     target.SendMessage(InternalOutgoingMessage);
     return(this);
 }
Esempio n. 16
0
 public IMessageable SendMessage(IInternalOutgoingMessage message)
 {
     foreach (IRoomUnit roomUnit in RoomUnits)
     {
         IMessageable messageableRoomUnit = roomUnit as IMessageable;
         if (messageableRoomUnit != null)
         {
             messageableRoomUnit.SendMessage(message);
         }
     }
     return(this);
 }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(2);
                foreach (string fuseRight in FuseRights)
                {
                    InternalOutgoingMessage.AppendString(fuseRight);
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 18
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(7)
                .AppendString(SubscriptionName)
                .AppendInt32(CurrentDay)
                .AppendInt32(ElapsedMonths)
                .AppendInt32(PrepaidMonths)
                .AppendBoolean(IsActive);
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 19
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(7)
                    .AppendString(SubscriptionName)
                    .AppendInt32(CurrentDay)
                    .AppendInt32(ElapsedMonths)
                    .AppendInt32(PrepaidMonths)
                    .AppendBoolean(IsActive);
            }

            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 20
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        IMessageable messageable = collision.gameObject.GetComponent <IMessageable>();

        if (messageable != null)
        {
            bool msgReceived = messageable.DeliverMSG();

            if (msgReceived)
            {
                receiverMSGSpawner.ReceiverEnabled = false;
                gameObject.SetActive(false);
            }
        }
    }
Esempio n. 21
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(2);

                InternalOutgoingMessage.AppendInt32(FuseRights.Count);
                foreach (string fuseRight in FuseRights)
                {
                    InternalOutgoingMessage.AppendString(fuseRight);
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 22
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(12)
                    .AppendInt32(UnknownA)
                    .AppendInt32(UnknownB)
                    .AppendInt32(UnknownC)
                    .AppendInt32(Categories.Count()); // -1 because the default category doesn't count

                int friendCount = 0;

                foreach (MessengerCategory category in Categories)
                {
                    InternalOutgoingMessage
                        .AppendInt32(category.Id)
                        .AppendString(category.Name);
                    friendCount += category.Friends.Count();
                }

                InternalOutgoingMessage.AppendInt32(friendCount);

                foreach (MessengerCategory category in Categories)
                {
                    foreach (IBefriendable befriendable in category.Friends)
                    {
                        InternalOutgoingMessage
                            .AppendInt32(befriendable.Id)
                            .AppendString(befriendable.DisplayName)
                            .AppendBoolean(true) // TODO: Find out what this does.
                            .AppendBoolean(befriendable.LoggedIn)
                            .AppendBoolean(befriendable.Stalkable)
                            .AppendString(befriendable.Figure.ToString())
                            .AppendInt32(category.Id)
                            .AppendString(befriendable.Motto)
                            .AppendString(befriendable.LastAccess.ToString(CultureInfo.InvariantCulture));
                    }
                }

                InternalOutgoingMessage
                    .AppendInt32(MaximumFriends)
                    .AppendBoolean(false); // TODO: Find out what this does.
            }

            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 23
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(12)
                .AppendInt32(UnknownA)
                .AppendInt32(UnknownB)
                .AppendInt32(UnknownC)
                .AppendInt32(Categories.Count());     // -1 because the default category doesn't count

                int friendCount = 0;

                foreach (MessengerCategory category in Categories)
                {
                    InternalOutgoingMessage
                    .AppendInt32(category.Id)
                    .AppendString(category.Name);
                    friendCount += category.Friends.Count();
                }

                InternalOutgoingMessage.AppendInt32(friendCount);

                foreach (MessengerCategory category in Categories)
                {
                    foreach (IBefriendable befriendable in category.Friends)
                    {
                        InternalOutgoingMessage
                        .AppendInt32(befriendable.Id)
                        .AppendString(befriendable.DisplayName)
                        .AppendBoolean(true)     // TODO: Find out what this does.
                        .AppendBoolean(befriendable.LoggedIn)
                        .AppendBoolean(befriendable.Stalkable)
                        .AppendString(befriendable.Figure.ToString())
                        .AppendInt32(category.Id)
                        .AppendString(befriendable.Motto)
                        .AppendString(befriendable.LastAccess.ToString(CultureInfo.InvariantCulture));
                    }
                }

                InternalOutgoingMessage
                .AppendInt32(MaximumFriends)
                .AppendBoolean(false);     // TODO: Find out what this does.
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(12)
                .AppendInt32(UnknownA)
                .AppendInt32(UnknownB)
                .AppendInt32(UnknownC)
                .AppendInt32(Categories.Count() - 1);     // -1 because the default category doesn't count

                foreach (Category category in Categories.Where(category => category.ID != 0))
                {
                    InternalOutgoingMessage
                    .AppendInt32(category.ID)
                    .AppendString(category.Name);
                }

                InternalOutgoingMessage
                .AppendInt32(Friends.Count());

                foreach (Friend friend in Friends)
                {
                    foreach (Category category in friend.GetCategories())
                    {
                        InternalOutgoingMessage
                        .AppendInt32(friend.Befriendable.GetID())
                        .AppendString(friend.Befriendable.GetDisplayName())
                        .AppendBoolean(true)     // TODO: Find out what this does.
                        .AppendBoolean(friend.Befriendable.IsLoggedIn())
                        .AppendBoolean(friend.Befriendable.IsStalkable())
                        .AppendString(friend.Befriendable.GetFigure().ToString())
                        .AppendInt32(category.ID)
                        .AppendString(friend.Befriendable.GetMotto())
                        .AppendString(friend.Befriendable.GetLastAccess().ToString());
                    }
                }

                InternalOutgoingMessage
                .AppendInt32(MaximumFriends)
                .AppendBoolean(false);     // TODO: Find out what this does.
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(221)
                .AppendInt32(Categories.Count);

                foreach (Category category in Categories)
                {
                    InternalOutgoingMessage
                    .AppendInt32(category.ID)
                    .AppendString(category.Name);
                    continue;
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(221)
                    .AppendInt32(Categories.Count);

                foreach (Category category in Categories)
                {
                    InternalOutgoingMessage
                        .AppendInt32(category.ID)
                        .AppendString(category.Name);
                    continue;
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(435)
                .AppendInt32(_friends.Count);

                foreach (IBefriendable friend in _friends)
                {
                    InternalOutgoingMessage.
                    AppendInt32(friend.GetID()).
                    AppendString(friend.GetDisplayName()).
                    AppendString(friend.GetMotto()).
                    AppendBoolean(friend.IsLoggedIn()).
                    AppendBoolean((friend.GetRoom() != null) &&
                                  friend.GetInstanceVariable("Messenger.StalkBlock") == null).
                    AppendString("").
                    AppendBoolean(true).
                    AppendString(friend.GetFigure().ToString()).
                    AppendString(friend.GetLastAccess().ToString());
                }

                InternalOutgoingMessage
                .AppendInt32(_strangers.Count);

                foreach (IBefriendable stranger in _strangers)
                {
                    InternalOutgoingMessage.
                    AppendInt32(stranger.GetID()).
                    AppendString(stranger.GetDisplayName()).
                    AppendString(stranger.GetMotto()).
                    AppendBoolean(stranger.IsLoggedIn()).
                    AppendBoolean((stranger.GetRoom() != null) &&
                                  stranger.GetInstanceVariable("Messenger.StalkBlock") == null).
                    AppendString("").
                    AppendBoolean(false).
                    AppendString(stranger.GetFigure().ToString()).
                    AppendString(stranger.GetLastAccess().ToString());
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(13)
                .AppendInt32(Categories.Count - 1);     // -1 because the default category doesn't count.
                foreach (Category category in Categories.Where(category => category.ID != 0))
                {
                    InternalOutgoingMessage
                    .AppendInt32(category.ID)
                    .AppendString(category.Name);
                }

                InternalOutgoingMessage
                .AppendInt32(FriendUpdates.Count);

                foreach (MessengerFriendEventArgs friendUpdate in FriendUpdates)
                {
                    Friend friend = friendUpdate.Friend;

                    InternalOutgoingMessage
                    .AppendInt32((int)friendUpdate.Type)
                    .AppendInt32(friend.Befriendable.GetID());

                    if (friendUpdate.Type != FriendUpdateType.Removed)
                    {
                        InternalOutgoingMessage
                        .AppendString(friend.Befriendable.GetDisplayName())
                        .AppendBoolean(false)     // TODO: Find out what this does.
                        .AppendBoolean(friend.Befriendable.IsLoggedIn())
                        .AppendBoolean(friend.Befriendable.IsStalkable())
                        .AppendString(friend.Befriendable.GetFigure().ToString())
                        .AppendInt32(friendUpdate.Category.ID)
                        .AppendString(friend.Befriendable.GetMotto())
                        .AppendString(friend.Befriendable.GetLastAccess().ToString());
                    }
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 29
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(5)
                .AppendString(HabboId.ToString(CultureInfo.InvariantCulture))
                .AppendString(Username)     // TODO: Should this be display name?
                .AppendString(Figure.ToString())
                .AppendString(Figure.GenderChar.ToString(CultureInfo.InvariantCulture))
                .AppendString(Motto)
                .AppendString(UnknownA)
                .AppendInt32(12)     // TODO: Find out what this does.
                .AppendString(Figure.FormattedSwimFigure)
                .AppendBoolean(false)
                .AppendBoolean(true);
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(351)
                .AppendInt32(RoomListings.Count);


                foreach (GuestRoomListing roomListing in RoomListings)
                {
                    InternalOutgoingMessage
                    .AppendInt32(roomListing.ID)
                    .AppendString(roomListing.Name)
                    .AppendString(roomListing.Owner.GetDisplayName());

                    switch (roomListing.LockMode)
                    {
                    case RoomLock.Open:
                        InternalOutgoingMessage.AppendString("open");
                        break;

                    case RoomLock.Password:
                        InternalOutgoingMessage.AppendString("password");
                        break;

                    case RoomLock.Doorbell:
                        InternalOutgoingMessage.AppendString("closed");
                        break;
                    }

                    InternalOutgoingMessage
                    .AppendInt32(roomListing.Population)
                    .AppendInt32(roomListing.Capacity)
                    .AppendString(roomListing.Description);
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 31
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(229)
                    .AppendInt32(AllBadges.Count);
                foreach (string badge in AllBadges)
                {
                    InternalOutgoingMessage
                        .AppendString(badge);
                }
                foreach (KeyValuePair<BadgeSlot, string> slotBadge in BadgeSlots)
                {
                    InternalOutgoingMessage
                        .AppendInt32((int) slotBadge.Key)
                        .AppendString(slotBadge.Value);
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 32
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(229)
                .AppendInt32(AllBadges.Count);
                foreach (string badge in AllBadges)
                {
                    InternalOutgoingMessage
                    .AppendString(badge);
                }
                foreach (KeyValuePair <BadgeSlot, string> slotBadge in BadgeSlots)
                {
                    InternalOutgoingMessage
                    .AppendInt32((int)slotBadge.Key)
                    .AppendString(slotBadge.Value);
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(0);
                // TODO: Finish this.
                // (What does packet 57 (@y) do?

                //// if (dTable.Rows.Count > 0)
                //// {
                ////     StringBuilder Rooms = new StringBuilder();
                ////     foreach (DataRow dRow in dTable.Rows)
                ////         Rooms.Append(Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + Convert.ToString(dRow["name"]) + Convert.ToChar(2) + _Username + Convert.ToChar(2) + roomManager.getRoomState(Convert.ToInt32(dRow["state"])) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_now"])) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_max"])) + Convert.ToString(dRow["description"]) + Convert.ToChar(2));
                ////     sendData("@P" + Encoding.encodeVL64(dTable.Rows.Count) + Rooms.ToString());
                //// }
                //// else
                //// {
                ////     sendData("@y" + _Username);
                //// }
            }
            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 34
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(0);
                // TODO: Finish this.
                // (What does packet 57 (@y) do?

                //// if (dTable.Rows.Count > 0)
                //// {
                ////     StringBuilder Rooms = new StringBuilder();
                ////     foreach (DataRow dRow in dTable.Rows)
                ////         Rooms.Append(Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + Convert.ToString(dRow["name"]) + Convert.ToChar(2) + _Username + Convert.ToChar(2) + roomManager.getRoomState(Convert.ToInt32(dRow["state"])) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_now"])) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_max"])) + Convert.ToString(dRow["description"]) + Convert.ToChar(2));
                ////     sendData("@P" + Encoding.encodeVL64(dTable.Rows.Count) + Rooms.ToString());
                //// }
                //// else
                //// {
                ////     sendData("@y" + _Username);
                //// }
            }
            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Esempio n. 35
0
        void _Broadcast(string message, IMessageable sender)
        {
            lock (_Chatters)
            {
                var m = new Message()
                {
                    Name = sender.Name, Context = message
                };

                lock (_Messages)
                {
                    if (_Messages.Count > 10)
                    {
                        _Messages.RemoveAt(0);
                    }
                    _Messages.Add(m);
                }

                foreach (var chatter in _Chatters.Items)
                {
                    chatter.Messager.PublicReceive(m);
                }
            }
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(351)
                    .AppendInt32(RoomListings.Count);

                foreach (GuestRoomListing roomListing in RoomListings)
                {
                    InternalOutgoingMessage
                        .AppendInt32(roomListing.ID)
                        .AppendString(roomListing.Name)
                        .AppendString(roomListing.Owner.GetDisplayName());

                    switch (roomListing.LockMode)
                    {
                        case RoomLock.Open:
                            InternalOutgoingMessage.AppendString("open");
                            break;
                        case RoomLock.Password:
                            InternalOutgoingMessage.AppendString("password");
                            break;
                        case RoomLock.Doorbell:
                            InternalOutgoingMessage.AppendString("closed");
                            break;
                    }

                    InternalOutgoingMessage
                        .AppendInt32(roomListing.Population)
                        .AppendInt32(roomListing.Capacity)
                        .AppendString(roomListing.Description);
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 37
0
 public abstract OutgoingMessage Send(IMessageable Target);
Esempio n. 38
0
 internal MessageEchoEventArgs(IMessageable target, string content)
 {
     Target  = target;
     Content = content;
 }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(220)
                    .AppendBoolean(ExcludeFullRooms)
                    .AppendInt32(ID)
                    .AppendInt32(IsPublicCategory ? 0 : 2)
                    .AppendString(Name)
                    .AppendInt32(UnknownA)
                    .AppendInt32(UnknownB)
                    .AppendInt32(ParentID);

                if(!IsPublicCategory)
                    InternalOutgoingMessage
                        .AppendInt32(
                            Listings
                                .Where(listing => listing is GuestRoomListing)
                                .Count());

                foreach (Listing listing in Listings)
                {
                    if (listing is Category)
                    {
                        InternalOutgoingMessage
                            .AppendInt32(listing.ID)
                            .AppendBoolean(false)
                            .AppendString(listing.Name)
                            .AppendInt32(listing.Population)
                            .AppendInt32(listing.Capacity)
                            .AppendInt32(ID);
                        continue;
                    }

                    if (listing is GuestRoomListing)
                    {
                        GuestRoomListing specificListing = listing as GuestRoomListing;

                        InternalOutgoingMessage
                            .AppendInt32(listing.ID)
                            .AppendString(listing.Name)
                            .AppendString(specificListing.Owner.GetDisplayName());

                        switch (specificListing.LockMode)
                        {
                            case RoomLock.Open:
                                {
                                    InternalOutgoingMessage.AppendString("open");
                                    break;
                                }
                            case RoomLock.Password:
                                {
                                    InternalOutgoingMessage.AppendString("password");
                                    break;
                                }
                            case RoomLock.Doorbell:
                                {
                                    InternalOutgoingMessage.AppendString("closed");
                                    break;
                                }
                        }
                        InternalOutgoingMessage
                            .AppendInt32(listing.Population)
                            .AppendInt32(listing.Capacity)
                            .AppendString(specificListing.Description);
                        continue;
                    }

                    if (listing is PublicRoomListing)
                    {
                        PublicRoomListing specificListing = listing as PublicRoomListing;

                        InternalOutgoingMessage
                            .AppendInt32(listing.ID)
                            .AppendBoolean(true)
                            .AppendString(listing.Name)
                            .AppendInt32(listing.Population)
                            .AppendInt32(listing.Capacity)
                            // Possible category ID needed here?
                            .AppendString(specificListing.Description)
                            .AppendInt32(listing.ID)
                            .AppendInt32(UnknownA)
                            .AppendString(specificListing.ClientFiles)
                            .AppendInt32(UnknownB)
                            .AppendInt32(UnknownC);
                        continue;
                    }
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 40
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.Id == 0)
            {
                InternalOutgoingMessage.Initialize(257)
                    .AppendInt32(A)
                    .AppendInt32(B)
                    .AppendInt32(C)
                    .AppendInt32(D)
                    .AppendInt32(E)
                    .AppendInt32(F)
                    .AppendInt32(G)
                    .AppendInt32(H)
                    .AppendInt32(I)
                    .AppendInt32(J)
                    .AppendInt32(K)
                    .AppendInt32(L)
                    .AppendString(DateFormat)
                    .AppendString(M)
                    .AppendInt32(N)
                    .AppendBoolean(O)
                    .AppendInt32(P)
                    .AppendString(URL)
                    .AppendString(Q)
                    .AppendInt32(R)
                    .AppendBoolean(S);
            }

            target.SendMessage(InternalOutgoingMessage);
            return this;
        }
Esempio n. 41
0
        public void Unsubscribe <TId>(IMessageable <TId> receiver)
        {
            Assert.IsNotNull(receiver);

            GetDispatcherGroup <TId>().Unsubscribe(receiver);
        }
Esempio n. 42
0
 public void UnsubscribeAll(IMessageable receiver)
 {
     receivers.Remove(receiver);
 }
Esempio n. 43
0
 public void SubscribeAll(IMessageable receiver)
 {
     receivers.Add(receiver);
 }
Esempio n. 44
0
        private void ConfirmLogin(object source, EventArgs e)
        {
            IMessageable sender = (IMessageable)source;

            new MAuthenticationOkay().Send(sender);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(220)
                .AppendBoolean(ExcludeFullRooms)
                .AppendInt32(ID)
                .AppendInt32(IsPublicCategory ? 0 : 2)
                .AppendString(Name)
                .AppendInt32(UnknownA)
                .AppendInt32(UnknownB)
                .AppendInt32(ParentID);

                if (!IsPublicCategory)
                {
                    InternalOutgoingMessage
                    .AppendInt32(
                        Listings
                        .Where(listing => listing is GuestRoomListing)
                        .Count());
                }

                foreach (Listing listing in Listings)
                {
                    if (listing is Category)
                    {
                        InternalOutgoingMessage
                        .AppendInt32(listing.ID)
                        .AppendBoolean(false)
                        .AppendString(listing.Name)
                        .AppendInt32(listing.Population)
                        .AppendInt32(listing.Capacity)
                        .AppendInt32(ID);
                        continue;
                    }

                    if (listing is GuestRoomListing)
                    {
                        GuestRoomListing specificListing = listing as GuestRoomListing;

                        InternalOutgoingMessage
                        .AppendInt32(listing.ID)
                        .AppendString(listing.Name)
                        .AppendString(specificListing.Owner.GetDisplayName());

                        switch (specificListing.LockMode)
                        {
                        case RoomLock.Open:
                        {
                            InternalOutgoingMessage.AppendString("open");
                            break;
                        }

                        case RoomLock.Password:
                        {
                            InternalOutgoingMessage.AppendString("password");
                            break;
                        }

                        case RoomLock.Doorbell:
                        {
                            InternalOutgoingMessage.AppendString("closed");
                            break;
                        }
                        }
                        InternalOutgoingMessage
                        .AppendInt32(listing.Population)
                        .AppendInt32(listing.Capacity)
                        .AppendString(specificListing.Description);
                        continue;
                    }


                    if (listing is PublicRoomListing)
                    {
                        PublicRoomListing specificListing = listing as PublicRoomListing;

                        InternalOutgoingMessage
                        .AppendInt32(listing.ID)
                        .AppendBoolean(true)
                        .AppendString(listing.Name)
                        .AppendInt32(listing.Population)
                        .AppendInt32(listing.Capacity)
                        // Possible category ID needed here?
                        .AppendString(specificListing.Description)
                        .AppendInt32(listing.ID)
                        .AppendInt32(UnknownA)
                        .AppendString(specificListing.ClientFiles)
                        .AppendInt32(UnknownB)
                        .AppendInt32(UnknownC);
                        continue;
                    }
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }