示例#1
0
 void UserShown(object sender, UserEventArgs e)
 {
     AnnounceUser(e);
 }
示例#2
0
 void Client_UserLeft(object sender, UserEventArgs e)
 {
     if (__userLeft != null)
         __userLeft.Call(_host.ClientHost, ConvObj(e));
 }
示例#3
0
 void Client_UserFlagsChanged(object sender, UserEventArgs e)
 {
     if (__userFlagsChanged != null)
         __userFlagsChanged.Call(_host.ClientHost, ConvObj(e));
 }
示例#4
0
文件: Program.cs 项目: Mofsy/jinxbot
 static void client_UserLeft(object sender, UserEventArgs e)
 {
     Console.WriteLine("USER LEFT: {0}", e.User.Username);
 }
示例#5
0
文件: Program.cs 项目: Mofsy/jinxbot
 static void client_UserShown(object sender, UserEventArgs e)
 {
     Console.WriteLine("USER: {0} ({1})", e.User.Username, e.User.Stats.LiteralText);
 }
示例#6
0
        void UserFlagsChanged(object sender, UserEventArgs e)
        {

        }
示例#7
0
 void UserLeft(object sender, UserEventArgs e)
 {
     PostEvent(new ClientEvent { EventType = ClientEventType.UserLeft, EventData = e });
 }
示例#8
0
 private void ShowUser(UserEventArgs args)
 {
     ChatUser user = args.User;
     if (!listBox1.Items.Contains(args.User))
     {
         if ((user.Flags & UserFlags.ChannelOperator) == UserFlags.None)
         {
             this.listBox1.Items.Add(user);
         }
         else
         {
             int count = this.listBox1.Items.OfType<ChatUser>().Count(a => (a.Flags & UserFlags.ChannelOperator) == UserFlags.ChannelOperator);
             this.listBox1.Items.Insert(count, user);
         }
     }
     UpdateUserCount();
 }
示例#9
0
 void UserLeft(object sender, UserEventArgs e)
 {
     if (InvokeRequired)
         BeginInvoke(new Invokee<UserEventArgs>(RemoveUser), e);
     else
         RemoveUser(e);
 }
示例#10
0
        private void HandleUser(object sender, UserEventArgs e)
        {
            Product p = e.User.Stats.Product;
            if (p == Product.Warcraft3Retail || p == Product.Warcraft3Expansion)
            {
                // check to see if the user has a clan
                Warcraft3Stats w3s = e.User.Stats as Warcraft3Stats;
                string tag = w3s.ClanTag;
                NoteTag(tag, e.User, m_client.Client.ChannelName, e.EventType);
            }

            if (e.User.Username == m_client.Client.UniqueUsername)
            {
                if (m_nextClanID != 0)
                {
                    using (var dc = ClansDataContext.Create(m_dbPath))
                    {
                        var view = new ChannelView
                        {
                            ClanID = m_nextClanID,
                            AllowedView = true,
                            When = DateTime.Now,
                            UserCount = m_client.Client.Channel.Count,
                            UserList = FormatChannel(m_client.Client.Channel)
                        };
                        dc.ChannelViews.InsertOnSubmit(view);

                        try
                        {
                            dc.SubmitChanges();
                        }
                        catch (Exception ex)
                        {
                            m_client.MainWindow.AddChat(new ChatNode[] {
                                new ChatNode("JinxBot Clan Gnome error ", Color.DarkRed),
                                new ChatNode("Error saving a clan visit:", Color.Red),
                                ChatNode.NewLine,
                                new ChatNode(ex.ToString(), Color.OrangeRed)
                            });
                        }
                    }
                }
            }
        }
示例#11
0
 void UserFlagsUpdated(object sender, UserEventArgs e)
 {
     if (m_voidView && "The Void".Equals(m_client.ChannelName, StringComparison.Ordinal)) /* void view */
     {
         if (InvokeRequired)
             BeginInvoke(new Invokee<UserEventArgs>(ShowUser), e);
         else
             ShowUser(e);
     }
 }
示例#12
0
 private void user_Left(object sender, UserEventArgs e)
 {
     IJinxBotPrincipal user = m_db.FindExact(e.User);
 }
示例#13
0
 void UserFlagsChanged(object sender, UserEventArgs e)
 {
     PostEvent(new ClientEvent { EventData = e, EventType = ClientEventType.UserFlags });
 }
示例#14
0
 void UserJoined(object sender, UserEventArgs e)
 {
     PostEvent(new ClientEvent { EventData = e, EventType = ClientEventType.UserJoined });
 }
示例#15
0
 void UserLeft(object sender, UserEventArgs e)
 {
     chat.AddChat(new ChatNode(e.User.Username, CssClasses.UsernameOther), new ChatNode(" left the channel.", CssClasses.LeftChannel));
 }
示例#16
0
 private void RemoveUser(UserEventArgs args)
 {
     this.listBox1.Items.Remove(args.User);
     UpdateUserCount();
 }
示例#17
0
 void UserJoined(object sender, UserEventArgs e)
 {
     AnnounceUser(e);
 }
示例#18
0
 void UserJoined(object sender, UserEventArgs e)
 {
     if (InvokeRequired)
         BeginInvoke(new Invokee<UserEventArgs>(ShowUser), e);
     else
         ShowUser(e);
 }
示例#19
0
        private void AnnounceUser(UserEventArgs e)
        {
            ChatUser user = e.User;
            UserStats us = e.User.Stats;
            string imgID = m_prp.Icons.GetImageIdFor(user.Flags, us);
            ChatNode productNode = ChatNode.Empty;
            if (m_profile.IncludeIconsInChat)
            {
                Image img = m_prp.Icons.GetImageFor(user.Flags, us);
                productNode = new ImageChatNode(string.Concat(imgID, ".jpg"),
                    img, imgID);
            }

            switch (us.Product.ProductCode)
            {
                case "DRTL":
                case "DSHR":
                case "SSHR":
                case "STAR":
                case "SEXP":
                case "JSTR":
                case "W2BN":
                    StarcraftStats ss = us as StarcraftStats;
                    if (ss == null)
                        chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), productNode,
                            new ChatNode(string.Format(" joined the channel with {0}.", us.Product.Name), CssClasses.JoinedChannel));
                    else
                    {
                        chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), productNode, new ChatNode(string.Format(" joined the channel with {0} ({1} win{2}, ladder rating {3}, rank {4}).", ss.Product.Name, ss.Wins, ss.Wins != 1 ? "s" : string.Empty,
                            ss.LadderRating, ss.LadderRank), CssClasses.JoinedChannel));
                    }
                    break;
                case "D2DV":
                case "D2XP":
                    Diablo2Stats ds = us as Diablo2Stats;
                    if (ds == null)
                        chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), productNode, new ChatNode(string.Format(" joined the channel with {0}.", us.Product.Name), CssClasses.JoinedChannel));
                    else
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append(" joined the channel with ");
                        sb.Append(ds.Product.Name);
                        if (ds.IsRealmCharacter)
                        {
                            sb.Append(" as ");
                            sb.Append(ds.CharacterName);
                            sb.AppendFormat(", a level {0}", ds.Level);
                            if (ds.IsHardcoreCharacter)
                                sb.Append(" hardcore");
                            if (ds.IsLadderCharacter)
                                sb.Append(" ladder");
                            if (ds.IsExpansionCharacter)
                                sb.Append(" Expansion ");
                            else
                                sb.Append(" Classic ");
                            sb.Append(ds.CharacterClass);
                            sb.Append(".");

                            chat.AddChat(new ChatNode(ds.UserName, CssClasses.UsernameOther), new ChatNode(sb.ToString(), CssClasses.JoinedChannel));
                        }
                        else
                        {
                            chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), productNode, new ChatNode(string.Format(" joined the channel with {0}.", us.Product.Name), CssClasses.JoinedChannel));
                        }
                    }
                    break;
                case "WAR3":
                case "W3XP":
                    Warcraft3Stats ws = us as Warcraft3Stats;
                    if (ws == null)
                        chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), productNode, new ChatNode(string.Format(" joined the channel with {0}.", us.Product.Name), CssClasses.JoinedChannel));
                    else
                    {
                        if (string.IsNullOrEmpty(ws.ClanTag))
                        {
                            chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), productNode, new ChatNode(string.Format(" joined the channel with {0}, {1} icon tier {2}, level {3}.", ws.Product.Name, ws.IconRace, ws.IconTier, ws.Level), CssClasses.JoinedChannel));
                        }
                        else
                        {
                            chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), productNode, new ChatNode(string.Format(" of clan {0} joined the channel with {1}, {2} icon tier {3}, level {4}.", ws.ClanTag, ws.Product.Name, ws.IconRace, ws.IconTier, ws.Level), CssClasses.JoinedChannel));
                        }
                    }
                    break;
                default:
                    chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), productNode, new ChatNode(string.Format(" joined the channel with {0} ({1}).", us.Product.Name, us.LiteralText), CssClasses.JoinedChannel));
                    break;

            }
            if (user.Flags != UserFlags.None)
            {
                chat.AddChat(new ChatNode(user.Username, CssClasses.UsernameOther), new ChatNode(string.Format(" had the following flags: {0}", user.Flags), CssClasses.JoinedChannel));
            }
        }
示例#20
0
 void UserShown(object sender, UserEventArgs e)
 {
     PostEvent(new ClientEvent { EventData = e, EventType = ClientEventType.UserShown });
 }