public ConnectionGroup(ServerGroup sGroup, string nick) { this.pLog = new TabPage("Log\t"); this.tLog = new RichTextBox(); this.pLog.Controls.Add(this.tLog); this.pLog.Name = "pLog"; this.pLog.Padding = new Padding(3); this.pLog.TabIndex = 0; this.pLog.UseVisualStyleBackColor = true; this.pLog.Controls.Add(tLog); this.tLog.BackColor = System.Drawing.Color.FromArgb(224, 255, 192); this.tLog.Dock = DockStyle.Fill; this.tLog.Location = new System.Drawing.Point(3, 3); this.tLog.Name = "tLog"; this.tLog.ReadOnly = true; this.tLog.Size = new System.Drawing.Size(738, 447); this.tLog.TabIndex = 0; this.tLog.Text = "Minus One IRC client ver " + Util.VER + "\r\nby Yoshi-TS4"; this.tLog.TabStop = false; this.tLog.LinkClicked += new LinkClickedEventHandler(tLog_LinkClicked); this.tLog.PreviewKeyDown += new PreviewKeyDownEventHandler(tLine_PreviewKeyDown); this.tLog.LanguageOption = RichTextBoxLanguageOptions.DualFont; this.sGroup = sGroup; this.encode = sGroup.encode; this.host = sGroup.host[0]; this.channelPages = new List<ChannelPage>(); this.net = new Network(this); this.nick = nick; this.Text = sGroup.name; }
public void Open(ServerGroup sGroup) { this.sGroup = sGroup; lFavorite.Items.Clear(); foreach (string fav in sGroup.favorites) Util.addItem(lFavorite, fav); this.Font = MainForm.thisfrm.Font; this.ShowDialog(OptionForm.thisfrm); }
/// <summary> ini파일에서 불러들인다. </summary> private void readAll() { StreamReader reader = null; try { reader = new StreamReader(path); string line; string lineupper; Groups = new List<ServerGroup>(); ServerGroup sGroup = null; while ((line = reader.ReadLine()) != null) { lineupper = line.ToUpper(); if (lineupper.StartsWith("FONT=")) { try { String[] fontstr = line.Substring(5).Split(','); this.fonttemp = new Font( fontstr[0].Trim(), (float)Convert.ToDouble(fontstr[1]), (FontStyle)(Convert.ToInt32(fontstr[2]))); } catch (ArgumentException) { } } else if (lineupper.StartsWith("NICK=")) defaultNick = line.Substring(5); else if (lineupper.StartsWith("PASS="******"USER="******"VERSION=")) vermsg = line.Substring(8); else if (lineupper.StartsWith("QUIT=")) qmsg = line.Substring(5); else if (lineupper.StartsWith("GROUPNAME=")) { sGroup = new ServerGroup(line.Substring(10)); Groups.Add(sGroup); } else if (lineupper.StartsWith("ENCODING=")) { switch (line.Substring(9)) { case "UTF8": sGroup.encode = Encoding.UTF8; break; case "CP949": sGroup.encode = Encoding.GetEncoding(949); break; case "UTF16": sGroup.encode = Encoding.Unicode; break; default: sGroup.encode = Encoding.UTF8; break; } } else if (lineupper.StartsWith("HOST=")) sGroup.host = new List<string>(line.Substring(5).Split(',')); else if (lineupper.StartsWith("FAVORITE=")) { if (line.Length > 9) sGroup.favorites = new List<string>(line.Substring(9).Split(',')); else sGroup.favorites = new List<string>(); } } if (Groups.Count == 0) Groups.Add(new ServerGroup("Freenode", Encoding.UTF8, new List<string> { "irc.freenode.net/8000", "irc.freenode.net&/7000" }, new List<string>())); } catch (Exception) { Groups = new List<ServerGroup>(); Groups.Add(new ServerGroup("UriIRC", Encoding.UTF8, new List<string> { "irc.uriirc.org&/16663", "irc.uriirc.org/16667" }, new List<string>())); Groups.Add(new ServerGroup("HanIRC", Encoding.GetEncoding(949), new List<string> { "irc.hanirc.org/6664", "ddos.hanirc.org/6664", "purple.hanirc.org/6664", "64.71.156.44/6664" }, new List<string>())); Groups.Add(new ServerGroup("Freenode", Encoding.UTF8, new List<string> { "irc.freenode.net/8000", "irc.freenode.net&/7000" }, new List<string>())); cEncode.SelectedIndex = 1; passmsg = tPass.Text; usermsg = tUser.Text; qmsg = tQuit.Text; vermsg = "Minus One IRC v" + Util.VER; defaultNick = "Nick[-1]"; } finally { tGroup.Items.Clear(); foreach (ServerGroup sGroup in Groups) tGroup.Items.Add(sGroup.name); tGroup.SelectedIndex = 0; tPass.Text = passmsg; tUser.Text = usermsg; tQuit.Text = qmsg; if (vermsg == null || vermsg.StartsWith("Minus One IRC v")) vermsg = "Minus One IRC v" + Util.VER; tDefNick.Text = defaultNick; tVersion.Text = vermsg; if (reader != null) reader.Close(); else saveAll(); } }
private void AddHost(string group, string host) { if (group == "" || host == "") return; Util.addItem(tHost, host); ServerGroup sGroup = findGroup(group); if (sGroup == null) { Util.addItem(tGroup, group); sGroup = new ServerGroup(group, EncodeIndex(cEncode.SelectedIndex)); Groups.Add(sGroup); } if (!sGroup.host.Contains(host)) sGroup.host.Add(host); }