private void Redraw() { Core.Profiler profiler = null; if (Configuration.Kernel.Profiler) { profiler = new Core.Profiler("Redraw()"); } lock (richTextBox) { richTextBox.Buffer.Text = ""; lock (Lines) { foreach (Line curr in Lines) { DrawLine(curr); } } } if (Configuration.Kernel.Profiler) { profiler.Done(); } }
/// <summary> /// Process the line /// </summary> /// <returns></returns> public bool ProfiledResult() { if (Configuration.Kernel.Profiler) { Core.Profiler profiler = new Core.Profiler("IRC.ProfiledResult()"); bool result = Result(); profiler.Done(); return result; } return Result(); }
/// <summary> /// Thread safe, redraw all users in the user list in window, if exist /// </summary> public void RedrawUsers() { Core.Profiler profiler = null; if (Configuration.Kernel.Profiler) { profiler = new Core.Profiler("Channel.redrawUsers()"); } if (IsDestroyed) { return; } if (Core._KernelThread == System.Threading.Thread.CurrentThread) { Redraw = false; RetrieveWindow(); List<User> owners = new List<User>(); List<User> admins = new List<User>(); List<User> oper = new List<User>(); List<User> halfop = new List<User>(); List<User> vs = new List<User>(); List<User> users = new List<User>(); bool Inserted; Core.SystemForm.UpdateStatus(); if (Chat != null && Chat.isInitialised) { if (Chat.IsDestroyed) { if (Configuration.Kernel.Profiler) { profiler.Done(); } return; } if (Chat.Locked) { Redraw = true; Graphics.PidgeonList.Updated = true; UserListRefreshWait = true; if (Configuration.Kernel.Profiler) { profiler.Done(); } return; } lock (UserList) { foreach (User nick in UserList) { Inserted = false; if (nick.ChannelMode._Mode.Count > 0) { lock (_Network.CUModes) { foreach (char mode in _Network.CUModes) { if (nick.ChannelMode._Mode.Contains(mode.ToString())) { switch (mode) { case 'q': owners.Add(nick); Inserted = true; break; case 'a': admins.Add(nick); Inserted = true; break; case 'o': Inserted = true; oper.Add(nick); break; case 'h': Inserted = true; halfop.Add(nick); break; case 'v': vs.Add(nick); Inserted = true; break; } if (!Inserted) { users.Add(nick); Inserted = true; } break; } } } } if (Inserted == true) { continue; } users.Add(nick); } } Chat.UserList.Clear(); owners.Sort(); admins.Sort(); halfop.Sort(); oper.Sort(); vs.Sort(); users.Sort(); foreach (User user in owners) { Chat.UserList.AppendValues(uchr(user) + user.Nick, user, user.ConvertToInfoString()); user.Status = User.ChannelStatus.Owner; } foreach (User user in admins) { Chat.UserList.AppendValues(uchr(user) + user.Nick, user, user.ConvertToInfoString()); user.Status = User.ChannelStatus.Admin; } foreach (User user in oper) { Chat.UserList.AppendValues(uchr(user) + user.Nick, user, user.ConvertToInfoString()); user.Status = User.ChannelStatus.Op; } foreach (User user in halfop) { Chat.UserList.AppendValues(uchr(user) + user.Nick, user, user.ConvertToInfoString()); user.Status = User.ChannelStatus.Halfop; } foreach (User user in vs) { Chat.UserList.AppendValues(uchr(user) + user.Nick, user, user.ConvertToInfoString()); user.Status = User.ChannelStatus.Voice; } foreach (User user in users) { Chat.UserList.AppendValues(uchr(user) + user.Nick, user, user.ConvertToInfoString()); user.Status = User.ChannelStatus.Regular; } } if (Configuration.Kernel.Profiler) { profiler.Done(); } return; } Redraw = true; Graphics.PidgeonList.Updated = true; if (Configuration.Kernel.Profiler) { profiler.Done(); } return; }