public void UpdateTemplate() { this.label1.Text = StringTemplate.Get(STType.Settings, 9); this.groupBox1.Text = StringTemplate.Get(STType.AudioSettings, 0); this.label2.Text = StringTemplate.Get(STType.AudioSettings, 1) + ":"; this.label3.Text = StringTemplate.Get(STType.AudioSettings, 2) + ":"; this.checkBox1.Text = StringTemplate.Get(STType.AudioSettings, 3); this.checkBox2.Text = StringTemplate.Get(STType.AudioSettings, 4); this.checkBox6.Text = StringTemplate.Get(STType.AudioSettings, 5); this.groupBox2.Text = StringTemplate.Get(STType.AudioSettings, 6); this.label4.Text = StringTemplate.Get(STType.AudioSettings, 7) + ":"; this.checkBox3.Text = StringTemplate.Get(STType.AudioSettings, 8); this.checkBox4.Text = StringTemplate.Get(STType.AudioSettings, 9); this.checkBox5.Text = StringTemplate.Get(STType.AudioSettings, 10); }
public void EndReceived() { this.LeftContainer.SetHeader(StringTemplate.Get(STType.BrowseTab, 14) + " (" + this.so_far + ")"); int a = this.files.Count; int b = this.files.FindAll(x => x.Mime == BrowseType.Audio).Count; int c = this.files.FindAll(x => x.Mime == BrowseType.Image).Count; int d = this.files.FindAll(x => x.Mime == BrowseType.Video).Count; int e = this.files.FindAll(x => x.Mime == BrowseType.Document).Count; int f = this.files.FindAll(x => x.Mime == BrowseType.Software).Count; int g = this.files.FindAll(x => x.Mime == BrowseType.Other).Count; this.LeftContainer.UpdateTotals(a, b, c, d, e, f, g); this.LeftContainer.CanSelectNode = true; this.SetContent(0); }
public void UpdateTemplate() { this.client_settings.UpdateTemplate(); this.global_settings.UpdateTemplate(); this.hashlink_settings.UpdateTemplate(); this.personal_settings.UpdateTemplate(); this.audio_settings.UpdateTemplate(); this.filter_settings.UpdateTemplate(); this.menu_settings.UpdateTemplate(); this.privacy_settings.UpdateTemplate(); for (int i = 0; i < 8; i++) // 8 = number of regular settings panels { this.treeView1.Nodes[i].Text = StringTemplate.Get(STType.Settings, (i * 2)); } }
public void UpdateTemplate() { this.label1.Text = StringTemplate.Get(STType.Settings, 13); this.label2.Text = StringTemplate.Get(STType.MenuSettings, 0) + ":"; this.label3.Text = StringTemplate.Get(STType.MenuSettings, 1) + ":"; this.dataGridView1.Columns[0].HeaderText = StringTemplate.Get(STType.MenuSettings, 2); this.dataGridView2.Columns[0].HeaderText = StringTemplate.Get(STType.MenuSettings, 2); this.dataGridView1.Columns[1].HeaderText = StringTemplate.Get(STType.MenuSettings, 3); this.dataGridView2.Columns[1].HeaderText = StringTemplate.Get(STType.MenuSettings, 3); this.removeToolStripMenuItem.Text = StringTemplate.Get(STType.MenuSettings, 4); this.removeToolStripMenuItem1.Text = StringTemplate.Get(STType.MenuSettings, 4); this.groupBox1.Text = StringTemplate.Get(STType.MenuSettings, 5); this.label4.Text = StringTemplate.Get(STType.MenuSettings, 6) + ":"; this.label5.Text = StringTemplate.Get(STType.MenuSettings, 7) + ": [+n]"; this.button1.Text = StringTemplate.Get(STType.MenuSettings, 8); }
private void Eval_Ack(TCPPacketReader packet, uint time) { this.ticks = time; this.last_lag = (time - 25); this.reconnect_count = 0; this.Panel.CheckUnreadStatus(); this.Panel.Userlist.ClearUserList(); this.users.ForEach(x => x.Dispose()); this.users.Clear(); this.users = new List <User>(); Scripting.ScriptManager.ClearUsers(this.EndPoint); this.Panel.ServerText(StringTemplate.Get(STType.Messages, 18) + "..."); this.Panel.CanVC(false); this.CanVC = false; this.CanOpusVC = false; this.MyName = packet.ReadString(this.crypto); this.Panel.MyName = this.MyName; if (packet.Remaining > 0) { String room_name = packet.ReadString(this.crypto); bool update_name = false; if (!String.IsNullOrEmpty(this.Credentials.Name)) { if (this.Credentials.Name != room_name) { if (this.EndPoint.Equals(this.Credentials.ToEndPoint())) { update_name = true; } } } this.Credentials.Name = room_name; if (update_name) { this.RoomNameChanged(this.Credentials, EventArgs.Empty); } } this.Panel.Userlist.MyLevel = 0; this.is_writing = false; this.Panel.ClearWriters(); }
public void UpdateTemplate() { this.toolStripButton1.ToolTipText = StringTemplate.Get(STType.ChannelList, 0); this.toolStripLabel1.Text = StringTemplate.Get(STType.ChannelList, 1) + ":"; this.toolStripLabel2.Text = StringTemplate.Get(STType.ChannelList, 2) + ":"; this.toolStripLabel3.Text = " " + StringTemplate.Get(STType.AudioSettings, 7) + ":"; this.channelListView1.Columns[0].Text = StringTemplate.Get(STType.ChannelList, 3); this.channelListView2.Columns[0].Text = StringTemplate.Get(STType.ChannelList, 3); this.channelListView1.Columns[1].Text = StringTemplate.Get(STType.UserList, 15); this.channelListView2.Columns[1].Text = StringTemplate.Get(STType.UserList, 15); this.channelListView1.Columns[2].Text = StringTemplate.Get(STType.ChannelList, 4); this.channelListView2.Columns[2].Text = StringTemplate.Get(STType.ChannelList, 4); this.exportHashlinkToolStripMenuItem.Text = StringTemplate.Get(STType.ChannelList, 5); this.exportHashlinkToolStripMenuItem1.Text = StringTemplate.Get(STType.ChannelList, 5); this.addToFavouritesToolStripMenuItem.Text = StringTemplate.Get(STType.ChannelList, 6); this.removeFromFavouritesToolStripMenuItem.Text = StringTemplate.Get(STType.ChannelList, 7); this.autoJoinToolStripMenuItem.Text = StringTemplate.Get(STType.ChannelList, 8); this.contextMenuStrip2.Items[4].Text = StringTemplate.Get(STType.ChannelList, 9) + ":"; }
public void UpdateTemplate() { this.ctx_menu.Items[2].Text = StringTemplate.Get(STType.UserList, 1); this.ctx_menu.Items[3].Text = StringTemplate.Get(STType.UserList, 2); this.ctx_menu.Items[4].Text = StringTemplate.Get(STType.UserList, 3); this.ctx_menu.Items[5].Text = StringTemplate.Get(STType.UserList, 4); this.ctx_menu.Items[6].Text = StringTemplate.Get(STType.UserList, 5); this.ctx_menu.Items[7].Text = StringTemplate.Get(STType.UserList, 6); this.ctx_menu.Items[9].Text = StringTemplate.Get(STType.UserList, 7); this.ctx_menu.Items[10].Text = StringTemplate.Get(STType.UserList, 8); this.ctx_menu.Items[11].Text = StringTemplate.Get(STType.UserList, 9); this.ctx_menu.Items[12].Text = StringTemplate.Get(STType.UserList, 10); this.ctx_menu.Items[14].Text = StringTemplate.Get(STType.UserList, 11); this.ctx_menu.Items[15].Text = StringTemplate.Get(STType.UserList, 12); this.ctx_menu.Items[16].Text = StringTemplate.Get(STType.UserList, 13); this.ctx_menu.Items[17].Text = StringTemplate.Get(STType.UserList, 14); this.userListHeader1.UpdateTemplate(); this.userListBox1.Invalidate(); }
private void ShowTip(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); if (!String.IsNullOrEmpty(this.HeaderText)) { sb.AppendLine(this.HeaderText); } if (!String.IsNullOrEmpty(this.ServerVersion)) { sb.AppendLine(StringTemplate.Get(STType.UserList, 16) + " (" + this.ServerVersion + ")"); } if (this.lag > 0) { sb.AppendLine(StringTemplate.Get(STType.UserList, 17) + " (" + this.lag + " ms)"); } this.tip.SetToolTip(this, sb.ToString()); }
private void Eval_Topic(String text, bool updated) { String str = ScriptEvents.OnTopicReceiving(this, text); if (updated) { this.Panel.ServerText(StringTemplate.Get(STType.Messages, 11) + ": " + text); this.Credentials.Topic = text; this.Panel.SetTopic(text); } else if (!String.IsNullOrEmpty(str)) { this.Credentials.Topic = str; this.Panel.SetTopic(text); } if (this.should_check_for_current_topic_update) { this.should_check_for_current_topic_update = false; this.TopicChanged(this.Credentials, EventArgs.Empty); } }
private void Eval_Nudge(User user, byte[] data, uint time) { if (data.Length == 4) { if (data.SequenceEqual(new byte[] { 78, 65, 61, 61 })) { this.Panel.AnnounceText(GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Server, this.BlackBG) + "--- " + StringTemplate.Get(STType.Messages, 6).Replace("+x", user.Name)); return; } } if (Settings.GetReg <bool>("receive_nudge", true) && !user.Ignored) { if (time > this.last_nudge) { this.last_nudge = time; } else { return; } if (ScriptEvents.OnNudgeReceiving(this, user)) { this.Panel.AnnounceText(GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Server, this.BlackBG) + "--- " + StringTemplate.Get(STType.Messages, 5).Replace("+x", user.Name)); this.owner_frm.Nudge(); this.ShowPopup("cb0t :: " + StringTemplate.Get(STType.Messages, 3), StringTemplate.Get(STType.Messages, 5).Replace("+x", user.Name), PopupSound.None); } else { this.sock.Send(TCPOutbound.NudgeReject(user.Name, this.crypto)); } } else { this.sock.Send(TCPOutbound.NudgeReject(user.Name, this.crypto)); } }
public void Draw(DrawItemEventArgs e) { using (SolidBrush brush = new SolidBrush(Color.DarkGray)) e.Graphics.FillRectangle(brush, e.Bounds); using (SolidBrush brush = new SolidBrush(Color.WhiteSmoke)) using (Font font = new Font(e.Font, FontStyle.Bold)) { switch (this.Section) { case UserListBoxSectionType.Friends: e.Graphics.DrawString(StringTemplate.Get(STType.UserList, 18), font, brush, new PointF(e.Bounds.X, e.Bounds.Y + 1)); break; case UserListBoxSectionType.Admins: e.Graphics.DrawString(StringTemplate.Get(STType.UserList, 19), font, brush, new PointF(e.Bounds.X, e.Bounds.Y + 1)); break; case UserListBoxSectionType.Users: e.Graphics.DrawString(StringTemplate.Get(STType.UserList, 15), font, brush, new PointF(e.Bounds.X, e.Bounds.Y + 1)); break; } } }
public void UpdateTemplate() { this.accuTextBox1.UpdateTemplate(); this.webControl1.UpdateTemplate(); this.toolStripButton2.ToolTipText = StringTemplate.Get(STType.ButtonBar, 0); this.toolStripButton3.ToolTipText = StringTemplate.Get(STType.ButtonBar, 1); this.toolStripButton4.ToolTipText = StringTemplate.Get(STType.ButtonBar, 2); this.toolStripButton5.ToolTipText = StringTemplate.Get(STType.ButtonBar, 3); this.toolStripButton6.ToolTipText = StringTemplate.Get(STType.ButtonBar, 4); this.toolStripButton7.ToolTipText = StringTemplate.Get(STType.ButtonBar, 5); this.toolStripButton8.ToolTipText = StringTemplate.Get(STType.ButtonBar, 6) + "\r\n" + StringTemplate.Get(STType.ButtonBar, 7); this.toolStripButton9.ToolTipText = StringTemplate.Get(STType.ButtonBar, 8); this.toolStripDropDownButton1.ToolTipText = StringTemplate.Get(STType.RoomMenu, 0); this.toolStripButton1.ToolTipText = StringTemplate.Get(STType.RoomMenu, 1); this.toolStripDropDownButton1.DropDownItems[0].Text = StringTemplate.Get(STType.RoomMenu, 2); this.toolStripDropDownButton1.DropDownItems[1].Text = StringTemplate.Get(STType.RoomMenu, 3); this.toolStripDropDownButton1.DropDownItems[2].Text = StringTemplate.Get(STType.RoomMenu, 4); this.toolStripDropDownButton1.DropDownItems[3].Text = StringTemplate.Get(STType.RoomMenu, 5); this.toolStripDropDownButton1.DropDownItems[4].Text = StringTemplate.Get(STType.RoomMenu, 6); this.rc_ctx.Items[0].Text = StringTemplate.Get(STType.RoomMenu, 1); for (int i = 0; i < this.tabControl1.TabPages.Count; i++) { if (this.tabControl1.TabPages[i] is PMTab) { ((PMTab)this.tabControl1.TabPages[i]).UpdateTemplate(); } else if (this.tabControl1.TabPages[i] is BrowseTab) { ((BrowseTab)this.tabControl1.TabPages[i]).UpdateTemplate(); } } }
public void AddUserItem(User user) { if (this.userListBox1.InvokeRequired) { this.userListBox1.BeginInvoke(new RUIHandler(this.AddUserItem), user); } else { if (user.IsFriend) { int start_index = -1, end_index = -1; for (int i = 0; i < this.userListBox1.Items.Count; i++) { if (this.userListBox1.Items[i] is UserListBoxSectionItem) { if (((UserListBoxSectionItem)this.userListBox1.Items[i]).Section == UserListBoxSectionType.Friends) { start_index = i; } } if (this.userListBox1.Items[i] is UserListBoxSectionItem) { if (((UserListBoxSectionItem)this.userListBox1.Items[i]).Section == UserListBoxSectionType.Admins) { end_index = i; } } } if (start_index > -1 && end_index > start_index) { if (this.userListBox1.Items[end_index - 1] is UserListBoxEmptyItem) { int ti = this.userListBox1.TopIndex; this.userListBox1.Items.RemoveAt(end_index - 1); this.userListBox1.TopIndex = ti < this.userListBox1.Items.Count ? ti : (this.userListBox1.Items.Count - 1); this.userListBox1.Items.Insert((end_index - 1), new UserListBoxItem(user)); } else { this.userListBox1.Items.Insert(end_index, new UserListBoxItem(user)); } } } else if (user.Level > 0) { int start_index = -1, end_index = -1; for (int i = 0; i < this.userListBox1.Items.Count; i++) { if (this.userListBox1.Items[i] is UserListBoxSectionItem) { if (((UserListBoxSectionItem)this.userListBox1.Items[i]).Section == UserListBoxSectionType.Admins) { start_index = i; } } if (this.userListBox1.Items[i] is UserListBoxSectionItem) { if (((UserListBoxSectionItem)this.userListBox1.Items[i]).Section == UserListBoxSectionType.Users) { end_index = i; } } } if (start_index > -1 && end_index > start_index) { if (this.userListBox1.Items[end_index - 1] is UserListBoxEmptyItem) { int ti = this.userListBox1.TopIndex; this.userListBox1.Items.RemoveAt(end_index - 1); this.userListBox1.TopIndex = ti < this.userListBox1.Items.Count ? ti : (this.userListBox1.Items.Count - 1); this.userListBox1.Items.Insert((end_index - 1), new UserListBoxItem(user)); } else { this.userListBox1.Items.Insert(end_index, new UserListBoxItem(user)); } this.userListBox1.SortAdmins(); } } else { int ti = this.userListBox1.TopIndex; if (this.userListBox1.Items[this.userListBox1.Items.Count - 1] is UserListBoxEmptyItem) { this.userListBox1.Items.RemoveAt(this.userListBox1.Items.Count - 1); } this.userListBox1.TopIndex = ti < this.userListBox1.Items.Count ? ti : (this.userListBox1.Items.Count - 1); this.userListBox1.Items.Add(new UserListBoxItem(user)); } int total_count = 0; for (int i = 0; i < this.userListBox1.Items.Count; i++) { if (this.userListBox1.Items[i] is UserListBoxItem) { total_count++; } } this.userListHeader1.HeaderText = StringTemplate.Get(STType.UserList, 15) + " (" + total_count + ")"; this.userListHeader1.Invalidate(); } }
private void CTXMenuOpening(object sender, CancelEventArgs e) { int i = this.userListBox1.SelectedIndex; bool can_show = false; if (i > -1 && i < this.userListBox1.Items.Count) { if (this.userListBox1.Items[i] is UserListBoxItem) { can_show = true; this.CTXUserName = ((UserListBoxItem)this.userListBox1.Items[i]).Owner.Name; this.ctx_menu.Items[0].Text = StringTemplate.Get(STType.UserList, 0) + ": " + this.CTXUserName; this.ctx_menu.Items[7].Visible = ((UserListBoxItem)this.userListBox1.Items[i]).Owner.HasFiles; for (int x = 8; x < 13; x++) { this.ctx_menu.Items[x].Visible = this.MyLevel > 0; } for (int x = 13; x < 18; x++) { this.ctx_menu.Items[x].Visible = this.MyLevel == 3; } } } while (this.ctx_menu.Items.Count > 19) { this.ctx_menu.Items[19].Dispose(); } bool custom_options = false; if (Menus.UserList.Count > 0) { this.ctx_menu.Items[18].Visible = true; Menus.UserList.ForEach(x => this.ctx_menu.Items.Add(x.Name)); custom_options = true; } if (Scripting.ScriptManager.UserListMenuOptions.Count > 0) { if (!this.ctx_menu.Items[18].Visible) { this.ctx_menu.Items[18].Visible = true; } Scripting.ScriptManager.UserListMenuOptions.ForEach(x => this.ctx_menu.Items.Add(x.Text)); custom_options = true; } if (!custom_options) { this.ctx_menu.Items[18].Visible = false; } if (!can_show) { e.Cancel = true; } }
public void UpdateTemplate() { this.label1.Text = StringTemplate.Get(STType.ColorPicker, 0) + ":"; this.label2.Text = StringTemplate.Get(STType.ColorPicker, 1) + ":"; this.label7.Text = StringTemplate.Get(STType.ColorPicker, 2) + ":"; }
private void CTXItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Equals(this.ctx.Items[0])) { if (this.img_data != null) { byte[] tmp = this.img_data; this.ctx.Hide(); SharedUI.SaveFile.Filter = "Image|*.png"; SharedUI.SaveFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); SharedUI.SaveFile.FileName = String.Empty; if (SharedUI.SaveFile.ShowDialog() == DialogResult.OK) { try { File.WriteAllBytes(SharedUI.SaveFile.FileName, tmp); } catch { } } } } else if (e.ClickedItem.Equals(this.ctx.Items[1])) { if (this.img_data != null) { byte[] tmp = this.img_data; this.ctx.Hide(); this.EditScribbleClicked(tmp, EventArgs.Empty); } } else if (e.ClickedItem.Equals(this.ctx.Items[2])) { VoicePlayerItem item = VoicePlayer.Records.Find(x => x.ShortCut == this.vc_sc); this.ctx.Hide(); SharedUI.SaveFile.Filter = "Wav|*.wav"; SharedUI.SaveFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); SharedUI.SaveFile.FileName = String.Empty; if (SharedUI.SaveFile.ShowDialog() == DialogResult.OK) { try { if (item != null) { String org_path = Path.Combine(Settings.VoicePath, item.FileName + ".wav"); File.Copy(org_path, SharedUI.SaveFile.FileName); } } catch { } } } else if (e.ClickedItem.Equals(this.ctx.Items[3])) { this.Clear(); while (this.CanUndo) { this.ClearUndo(); } } else if (e.ClickedItem.Equals(this.ctx.Items[4])) { try { File.WriteAllLines(Settings.DataPath + "export.txt", this.Lines); Process.Start("notepad.exe", Settings.DataPath + "export.txt"); } catch { } } else if (e.ClickedItem.Equals(this.ctx.Items[5])) { try { if (this.SelectionLength == 0) { Clipboard.SetText(this.Text); } else { Clipboard.SetText(this.Text.Substring(this.SelectionStart, this.SelectionLength)); } } catch { } } else if (e.ClickedItem.Equals(this.ctx.Items[6])) { if (this.IsPaused) { this.IsPaused = false; while (this.paused_items.Count > 0) { PausedItem item = this.paused_items[0]; this.paused_items.RemoveAt(0); switch (item.Type) { case PausedItemType.Announce: this.ShowAnnounceText(item.Text); break; case PausedItemType.Emote: this.ShowEmoteText(item.Name, item.Text, null); break; case PausedItemType.PM: this.ShowPMText(item.Name, item.Text, null); break; case PausedItemType.Public: this.ShowPublicText(item.Name, item.Text, null); break; case PausedItemType.Server: this.ShowServerText(item.Text); break; } } this.paused_items = new List <PausedItem>(); this.ShowAnnounceText(GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Server, this.IsBlack) + "--- " + StringTemplate.Get(STType.OutBox, 6)); } else { this.ShowAnnounceText(GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Server, this.IsBlack) + "--- " + StringTemplate.Get(STType.OutBox, 7)); this.IsPaused = true; } } }
public BrowseLeftHeader() { this.InitializeComponent(); this.HeaderText = StringTemplate.Get(STType.BrowseTab, 0) + "..."; }
public void UpdateTemplate() { this.HeaderText = this.HeaderText.Replace("Users", StringTemplate.Get(STType.UserList, 15)); this.Invalidate(); }
public void ErrorReceived() { this.LeftContainer.SetHeader(StringTemplate.Get(STType.BrowseTab, 15)); }
private void Eval_Features(TCPPacketReader packet) { String version = packet.ReadString(this.crypto); this.Credentials.Server = version; this.Panel.ServerText(StringTemplate.Get(STType.Messages, 17) + ": " + version); this.Panel.Userlist.UpdateServerVersion(version); this.should_check_for_current_topic_update = true; if (version.StartsWith("sb0t 5.")) { version = version.Substring(version.IndexOf(" ") + 1).Split(' ')[0]; String vnum_str = new String(version.Where(x => Char.IsNumber(x)).ToArray()); uint vnum; if (!uint.TryParse(vnum_str, out vnum)) { vnum = 0; } this.new_sbot = (vnum >= 514); } else if (version.StartsWith("Ares 2.") || version.StartsWith("Ares_2.")) { this.new_sbot = true; // maybe future Ares Server will support cb0t Custom Fonts? } ServerFeatures flag = (ServerFeatures)((byte)packet); this.CanVC = ((flag & ServerFeatures.SERVER_SUPPORTS_VC) == ServerFeatures.SERVER_SUPPORTS_VC); bool has_html = ((flag & ServerFeatures.SERVER_SUPPORTS_HTML) == ServerFeatures.SERVER_SUPPORTS_HTML); bool has_scribble = ((flag & ServerFeatures.SERVER_SUPPORTS_ROOM_SCRIBBLES) == ServerFeatures.SERVER_SUPPORTS_ROOM_SCRIBBLES); bool has_pm_scribble = ((flag & ServerFeatures.SERVER_SUPPORTS_PM_SCRIBBLES) == ServerFeatures.SERVER_SUPPORTS_PM_SCRIBBLES); this.CanOpusVC = ((flag & ServerFeatures.SERVER_SUPPORTS_OPUS_VC) == ServerFeatures.SERVER_SUPPORTS_OPUS_VC); this.Panel.CanVC(this.CanVC); this.Panel.CanScribbleAll(has_scribble); this.Panel.CanScribblePM(has_pm_scribble); this.Panel.InitScribbleButton(); this.CanNP = true; if (has_html) { this.Panel.Userlist.AcquireServerIcon(this.EndPoint); } packet.SkipByte(); this.Panel.ServerText(StringTemplate.Get(STType.Messages, 16) + ": " + (RoomLanguage)((byte)packet)); uint cookie = packet; if (!String.IsNullOrEmpty(this.Credentials.Password)) { this.sock.Send(TCPOutbound.SecureAdminLogin(this.Credentials.Password, cookie, this.Credentials.IP)); } this.UpdatePersonalMessage(); if (Avatar.Data != null) { this.sock.SendTrickle(TCPOutbound.Avatar()); } if (Settings.GetReg <bool>("user_font_enabled", false)) { this.sock.SendTrickle(TCPOutbound.Font(this.new_sbot, this.crypto)); } if (Settings.GetReg <bool>("block_custom_names", false)) { this.sock.SendTrickle(TCPOutbound.BlockCustomNames(true)); } ScriptEvents.OnConnected(this); }
private void Eval_Join(TCPPacketReader packet) { User u = new User(); ushort files = packet; packet.SkipBytes(4); u.ExternalIP = packet; u.Port = packet; packet.SkipBytes(4); u.SupportsPMEnc = ((ushort)packet) == 65535; packet.SkipByte(); u.Name = packet.ReadString(this.crypto); u.LocalIP = packet; u.HasFiles = ((byte)packet) == 1 && files > 0; u.Level = packet; u.Age = packet; u.Gender = packet; byte country = packet; u.Country = Helpers.CountryCodeToString(country); u.Region = packet.ReadString(this.crypto); u.IsFriend = Friends.IsFriend(u.Name); if (packet.Remaining > 0) { ClientFeatures features = (ClientFeatures)((byte)packet); u.SupportsVC = ((features & ClientFeatures.CLIENT_SUPPORTS_VC) == ClientFeatures.CLIENT_SUPPORTS_VC); u.SupportsOpusVC = ((features & ClientFeatures.CLIENT_SUPPORTS_OPUS_VC) == ClientFeatures.CLIENT_SUPPORTS_OPUS_VC); if (u.SupportsOpusVC) { u.SupportsVC = true; } } User ghost = this.users.Find(x => x.Name == u.Name); if (ghost != null) { this.users.RemoveAll(x => x.Name == ghost.Name); if (ghost.Writing) { ghost.Writing = false; this.Panel.UpdateWriter(ghost); } this.Panel.Userlist.RemoveUserItem(ghost); if (ScriptEvents.OnUserParting(this, ghost)) { this.Panel.AnnounceText(GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Part, this.BlackBG) + StringTemplate.Get(STType.Messages, 12).Replace("+x", ghost.Name)); } ScriptEvents.OnUserParted(this, ghost); Scripting.ScriptManager.RemoveUser(this.EndPoint, u); ghost.Dispose(); ghost = null; } this.users.Add(u); this.Panel.Userlist.AddUserItem(u); Scripting.ScriptManager.AddUser(this.EndPoint, u); if (ScriptEvents.OnUserJoining(this, u)) { this.Panel.AnnounceText(GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Join, this.BlackBG) + StringTemplate.Get(STType.Messages, 13).Replace("+x", u.Name)); } if (u.Name == this.MyName) { u.IsAway = Settings.IsAway; this.Panel.Userlist.MyLevel = u.Level; } ScriptEvents.OnUserJoined(this, u); if (u.IsFriend) { if (!Settings.GetReg <bool>("block_friend_popup", false)) { this.ShowPopup("cb0t :: " + StringTemplate.Get(STType.Messages, 4), StringTemplate.Get(STType.Messages, 14).Replace("+x", u.Name).Replace("+y", this.Credentials.Name), PopupSound.Friend); } } }
private void CustomProtoReceived(TCPPacketReader packet, uint time) { String command = packet.ReadString(this.crypto); String sender = packet.ReadString(this.crypto); User u = this.users.Find(x => x.Name == sender); ulong lag; bool b; switch (command) { case "cb0t_writing": if (u == null) { return; } b = ((byte)packet) == 2; if (b != u.Writing) { u.Writing = b; this.Panel.UpdateWriter(u); ScriptEvents.OnUserWritingStatusChanged(this, u); } break; case "cb0t_latency_check": lag = (Helpers.UnixTimeMS - ((ulong)packet)); this.Panel.Userlist.UpdateLag(lag); break; case "cb0t_latency_mcheck": lag = (Helpers.UnixTimeMS - ((ulong)packet)); this.sock.Send(TCPOutbound.Public(StringTemplate.Get(STType.Messages, 7) + ": " + lag + " milliseconds", this.crypto)); break; case "cb0t_online_status": if (u == null) { return; } b = ((byte)packet) != 1; if (u.IsAway != b) { u.IsAway = b; this.Panel.Userlist.UpdateUserAppearance(u); ScriptEvents.OnUserOnlineStatusChanged(this, u); } break; case "cb0t_nudge": if (u == null) { return; } this.Eval_Nudge(u, ((byte[])packet), time); break; case "cb0t_pm_msg": if (u == null) { return; } this.Eval_cb0t_pm_msg(u, ((byte[])packet)); break; case "cb0t_scribble_once": if (u != null) { u.ScribbleBuffer = new List <byte>(); u.ScribbleBuffer.AddRange((byte[])packet); this.Eval_Scribble(u); } else if (String.IsNullOrEmpty(sender)) { this.unknown_scribble_buffer = new List <byte>(); this.unknown_scribble_buffer.AddRange((byte[])packet); this.Eval_Scribble_Unknown(); } break; case "cb0t_scribble_first": if (u != null) { u.ScribbleBuffer = new List <byte>(); u.ScribbleBuffer.AddRange((byte[])packet); } else if (String.IsNullOrEmpty(sender)) { this.unknown_scribble_buffer = new List <byte>(); this.unknown_scribble_buffer.AddRange((byte[])packet); } break; case "cb0t_scribble_chunk": if (u != null) { u.ScribbleBuffer.AddRange((byte[])packet); } else if (String.IsNullOrEmpty(sender)) { this.unknown_scribble_buffer.AddRange((byte[])packet); } break; case "cb0t_scribble_last": if (u != null) { u.ScribbleBuffer.AddRange((byte[])packet); this.Eval_Scribble(u); } else if (String.IsNullOrEmpty(sender)) { this.unknown_scribble_buffer.AddRange((byte[])packet); this.Eval_Scribble_Unknown(); } break; default: if (command.StartsWith("cb3_custom_")) { command = command.Substring(11); if (u != null) { String c_text = Encoding.UTF8.GetString((byte[])packet); ScriptEvents.OnCustomDataReceived(this, u, command, c_text); } } break; } }
private void PlayStateChange(int NewState) { int pos; switch ((WMPPlayState)NewState) { case WMPPlayState.wmppsPlaying: pos = this.play_list.FindIndex(x => x.Playing); if (pos > -1) { Song = this.play_list[pos].ToAudioTextString(); this.PlayPauseIconChanged(false, EventArgs.Empty); this.ShowAudioText("♫ 0:00 " + this.play_list[pos].ToAudioTextString() + " ♫", EventArgs.Empty); this.albumArtBox1.UpdateArt(this.play_list[pos]); this.label1.Text = StringTemplate.Get(STType.AudioPlayer, 1) + ":\r\n\r\n" + this.play_list[pos].ToAudioTextString(); } break; case WMPPlayState.wmppsMediaEnded: this.prepare_for_auto_next_track = 1; break; case WMPPlayState.wmppsStopped: if (this.prepare_for_auto_next_track == 1) { pos = this.play_list.FindIndex(x => x.Playing); if (pos > -1) { Song = String.Empty; this.play_list.ForEach(x => x.Playing = false); this.PlayPauseIconChanged(true, EventArgs.Empty); this.ShowAudioText(String.Empty, EventArgs.Empty); this.albumArtBox1.ClearArt(); this.label1.Text = String.Empty; if (DoRandom) { this.PlayRandom(); this.prepare_for_auto_next_track = 2; return; } pos++; if (pos >= this.play_list.Count && DoRepeat) { pos = 0; } for (int i = pos; i < this.play_list.Count; i++) { if (this.play_list[i].Exists) { this.play_list[i].Playing = true; this.Player.URL = this.play_list[i].Path; break; } } } this.prepare_for_auto_next_track = 2; } else if (this.prepare_for_auto_next_track > 1) { this.prepare_for_auto_next_track = 0; this.Player.controls.play(); } break; } }
private void Eval_VC_PM_Chunk(TCPPacketReader packet) { String sender = packet.ReadString(this.crypto); uint ident = packet; int index = VoicePlayer.Inbound.FindIndex(x => x.EndPoint.Equals(this.EndPoint) && x.Ident == ident); byte[] chunk = packet; if (index > -1) { VoicePlayerInboundItem item = VoicePlayer.Inbound[index]; item.AddChunk(chunk); if (item.Received) { VoicePlayer.Inbound.RemoveAt(index); item.Save(); if (!String.IsNullOrEmpty(item.FileName)) { VoicePlayerItem vc = item.ToVoicePlayerItem(++VoicePlayer.NEXT_SHORTCUT, this.BlackBG); VoicePlayer.Records.Add(vc); User u = this.users.Find(x => x.Name == vc.Sender); if (u != null) { if (!u.Ignored) { if (ScriptEvents.OnVoiceClipReceiving(this, u, true)) { this.Panel.PMTextReceived(this, u, vc.Sender, GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Server, this.BlackBG) + "--- \\\\voice_clip_#" + vc.ShortCut + " " + StringTemplate.Get(STType.Messages, 8).Replace("+x", vc.Sender), null, PMTextReceivedType.Announce); ScriptEvents.OnVoiceClipReceived(this, u, true); } } } } } } }
private void Eval_OfflineUser(TCPPacketReader packet) { String name = packet.ReadString(this.crypto); this.Panel.PMTextReceived(null, null, name, StringTemplate.Get(STType.Messages, 9), null, PMTextReceivedType.Announce); }
private void Eval_Part(TCPPacketReader packet) { String name = packet.ReadString(this.crypto); User u = this.users.Find(x => x.Name == name); this.users.RemoveAll(x => x.Name == name); if (u != null) { if (u.Writing) { u.Writing = false; this.Panel.UpdateWriter(u); } this.Panel.Userlist.RemoveUserItem(u); if (ScriptEvents.OnUserParting(this, u)) { this.Panel.AnnounceText(GlobalSettings.GetDefaultColorString(GlobalSettings.DefaultColorType.Part, this.BlackBG) + StringTemplate.Get(STType.Messages, 12).Replace("+x", u.Name)); } ScriptEvents.OnUserParted(this, u); Scripting.ScriptManager.RemoveUser(this.EndPoint, u); u.Dispose(); u = null; } }
public void UpdateTemplate() { this.button1.Text = StringTemplate.Get(STType.FilterSettings, 4); }
public void StartReceived(ushort count) { this.expected = count; this.LeftContainer.SetHeader(StringTemplate.Get(STType.BrowseTab, 0) + "... (0 / " + count + ")"); }
public void UpdateTemplate() { this.tabControl1.TabPages[0].Text = StringTemplate.Get(STType.ButtonBar, 5); this.tabControl1.TabPages[1].Text = "emoji"; }
public void UpdateTemplate() { this.label1.Text = StringTemplate.Get(STType.Settings, 5); this.button1.Text = StringTemplate.Get(STType.HashlinkSettings, 0); }