Exemple #1
0
        public void PrintStartupMessage()
        {
            ChatBufferItem title = new ChatBufferItem(
                DateTime.Now, Properties.Resources.SleekTitle, ChatBufferTextStyle.StartupTitle);

            ChatBufferItem ready = new ChatBufferItem(
                DateTime.Now, "Ready.\n", ChatBufferTextStyle.StatusBlue);

            ProcessBufferItem(title, true);
            ProcessBufferItem(ready, true);
        }
Exemple #2
0
        private void netcom_AlertMessageReceived(object sender, AlertMessageEventArgs e)
        {
            if (e.Message.ToLower().Contains("autopilot canceled")) return; //workaround the stupid autopilot alerts

            ChatBufferItem item = new ChatBufferItem(
                DateTime.Now, "Alert message: " + e.Message, ChatBufferTextStyle.Alert);

            ProcessBufferItem(item, true);
        }
Exemple #3
0
        //Used only for non-public chat
        private void ProcessOutgoingChat(ChatSentEventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("(channel ");
            sb.Append(e.Channel);
            sb.Append(") You");

            switch (e.Type)
            {
                case ChatType.Normal:
                    sb.Append(": ");
                    break;

                case ChatType.Whisper:
                    sb.Append(" whisper: ");
                    break;

                case ChatType.Shout:
                    sb.Append(" shout: ");
                    break;
            }

            sb.Append(e.Message);

            ChatBufferItem item = new ChatBufferItem(
                DateTime.Now, sb.ToString(), ChatBufferTextStyle.StatusDarkBlue);

            ProcessBufferItem(item, true);

            sb = null;
        }
Exemple #4
0
        private void ProcessIncomingChat(ChatEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Message)) return;

            StringBuilder sb = new StringBuilder();

            if (e.Message.StartsWith("/me "))
            {
                sb.Append(e.FromName);
                sb.Append(e.Message.Substring(3));
            }
            else if (e.FromName == netcom.LoginOptions.FullName && e.SourceType == ChatSourceType.Agent)
            {
                sb.Append("You");

                switch (e.Type)
                {
                    case ChatType.Normal:
                        sb.Append(": ");
                        break;

                    case ChatType.Whisper:
                        sb.Append(" whisper: ");
                        break;

                    case ChatType.Shout:
                        sb.Append(" shout: ");
                        break;
                }

                sb.Append(e.Message);
            }
            else
            {
                sb.Append(e.FromName);

                switch (e.Type)
                {
                    case ChatType.Normal:
                        sb.Append(": ");
                        break;

                    case ChatType.Whisper:
                        sb.Append(" whispers: ");
                        break;

                    case ChatType.Shout:
                        sb.Append(" shouts: ");
                        break;
                }

                sb.Append(e.Message);
            }

            ChatBufferItem item = new ChatBufferItem();
            item.Timestamp = DateTime.Now;
            item.Text = sb.ToString();

            switch (e.SourceType)
            {
                case ChatSourceType.Agent:
                    item.Style =
                        (e.FromName.EndsWith("Linden") ?
                        ChatBufferTextStyle.LindenChat : ChatBufferTextStyle.Normal);
                    break;

                case ChatSourceType.Object:
                    item.Style = ChatBufferTextStyle.ObjectChat;
                    break;
            }

            ProcessBufferItem(item, true);
            sb = null;
        }
Exemple #5
0
        private void ProcessBufferItem(ChatBufferItem item, bool addToBuffer)
        {
            if (addToBuffer) textBuffer.Add(item);

            if (showTimestamps)
            {
                textPrinter.ForeColor = Color.Gray;
                textPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
            }

            switch (item.Style)
            {
                case ChatBufferTextStyle.Normal:
                    textPrinter.ForeColor = Color.Black;
                    break;

                case ChatBufferTextStyle.StatusBlue:
                    textPrinter.ForeColor = Color.Blue;
                    break;

                case ChatBufferTextStyle.StatusDarkBlue:
                    textPrinter.ForeColor = Color.DarkBlue;
                    break;

                case ChatBufferTextStyle.LindenChat:
                    textPrinter.ForeColor = Color.DarkGreen;
                    break;

                case ChatBufferTextStyle.ObjectChat:
                    textPrinter.ForeColor = Color.DarkCyan;
                    break;

                case ChatBufferTextStyle.StartupTitle:
                    textPrinter.ForeColor = Color.Black;
                    textPrinter.Font = new Font(textPrinter.Font, FontStyle.Bold);
                    break;

                case ChatBufferTextStyle.Alert:
                    textPrinter.ForeColor = Color.DarkRed;
                    break;

                case ChatBufferTextStyle.Error:
                    textPrinter.ForeColor = Color.Red;
                    break;
            }

            textPrinter.PrintTextLine(item.Text);
        }
Exemple #6
0
        private void netcom_ClientLoginStatus(object sender, ClientLoginEventArgs e)
        {
            if (e.Status == LoginStatus.Success)
            {
                ChatBufferItem loggedIn = new ChatBufferItem(
                    DateTime.Now,
                    "Logged into Second Life as " + netcom.LoginOptions.FullName + ".",
                    ChatBufferTextStyle.StatusBlue);

                ChatBufferItem loginReply = new ChatBufferItem(
                    DateTime.Now, "Login reply: " + e.Message, ChatBufferTextStyle.StatusDarkBlue);

                ProcessBufferItem(loggedIn, true);
                ProcessBufferItem(loginReply, true);
            }
            else if (e.Status == LoginStatus.Failed)
            {
                ChatBufferItem loginError = new ChatBufferItem(
                    DateTime.Now, "Login error: " + e.Message, ChatBufferTextStyle.Error);

                ProcessBufferItem(loginError, true);
            }
        }
Exemple #7
0
        private void netcom_ClientLoggedOut(object sender, EventArgs e)
        {
            ChatBufferItem item = new ChatBufferItem(
                DateTime.Now, "Logged out of Second Life.\n", ChatBufferTextStyle.StatusBlue);

            ProcessBufferItem(item, true);
        }
Exemple #8
0
        private void netcom_ClientDisconnected(object sender, ClientDisconnectEventArgs e)
        {
            if (e.Type == NetworkManager.DisconnectType.ClientInitiated) return;

            ChatBufferItem item = new ChatBufferItem(
                DateTime.Now, "Client disconnected. Message: " + e.Message, ChatBufferTextStyle.Error);

            ProcessBufferItem(item, true);
        }