public static string GetFlog(string flog) { var url = HelperConverters.AddressEncode(string.Concat("http://neverlands.ru/logs.fcg?fid=", flog)); return(GetInfo(url)); }
private void InitGameTab() { if (tabControlLeft == null) { return; } if (tabControlLeft.TabPages.Count == 0) { return; } var tabPage = tabControlLeft.TabPages[0]; tabPage.Text = AppVars.Profile.UserNick; TabClass tabClass; if (tabPage.Tag == null) { tabClass = new TabClass { MyType = TabType.Game, WB = browserGame }; tabPage.Tag = tabClass; } browserGame.BeforeNewWindow -= wbTab_BeforeNewWindow; browserGame.BeforeNavigate -= browserGame_BeforeNavigate; browserGame.DocumentCompleted -= browserGame_DocumentCompleted; panelGame.Controls.Remove(browserGame); browserGame.Dispose(); browserGame = null; CookiesManager.ClearGame(); browserGame = new ExtendedWebBrowser { Dock = DockStyle.Fill, Name = "browserGame", ScriptErrorsSuppressed = true, TabIndex = 0, ObjectForScripting = new ScriptManager() }; browserGame.BeforeNewWindow += wbTab_BeforeNewWindow; browserGame.BeforeNavigate += browserGame_BeforeNavigate; browserGame.DocumentCompleted += browserGame_DocumentCompleted; panelGame.Controls.Add(browserGame); tabClass = (TabClass)tabPage.Tag; tabClass.WB = browserGame; tabPage.Tag = tabClass; buttonGameScreen.Tag = browserGame; var url = HelperConverters.AddressEncode(string.Concat("http://www.neverlands.ru/pinfo.cgi?", "Мастер Создатель")); browserGame.Navigate(url); while (browserGame != null && !browserGame.IsDisposed && browserGame.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); } if (browserGame != null && !browserGame.IsDisposed) { browserGame.Navigate(Resources.AddressNeverlands); while (browserGame != null && !browserGame.IsDisposed && browserGame.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); } if (browserGame != null && !browserGame.IsDisposed) { browserGame.Navigate(Resources.AddressNeverlands); } } }
public static string GetPInfo(string nick) { var url = HelperConverters.AddressEncode(string.Concat("http://neverlands.ru/pinfo.cgi?", nick)); return(GetInfo(url)); }
private void CreateNewTab(TabType tt, string tourl, bool delayed) { if (!string.IsNullOrEmpty(tourl)) { for (var index = 1; index < tabControlLeft.TabPages.Count; index++) { if (!tourl.Equals(TabGetUrl(index), StringComparison.OrdinalIgnoreCase)) { continue; } if (!delayed) { tabControlLeft.SelectedIndex = index; } return; } } var tabc = new TabClass { MyType = tt, Address = tourl, AddressInit = tourl, Delayed = delayed }; var tabpage = new TabPage(); ExtendedWebBrowser browser = null; TextBox textbox = null; if (tabc.MyType != TabType.Notepad) { browser = new ExtendedWebBrowser { Dock = DockStyle.Fill, ScriptErrorsSuppressed = true, ObjectForScripting = new ScriptManager() }; // !!! browser.BeforeNewWindow += wbTab_BeforeNewWindow; tabc.WB = browser; } else { textbox = new TextBox { BorderStyle = BorderStyle.None, Dock = DockStyle.Fill, Font = new Font("Courier New", 9F, FontStyle.Regular, GraphicsUnit.Point, 204), Multiline = true, ScrollBars = ScrollBars.Both, }; textbox.Leave += (sender, e) => AppVars.Profile.Notepad = ((TextBox)sender).Text; textbox.Text = AppVars.Profile.Notepad; textbox.SelectionStart = textbox.Text.Length; textbox.SelectionLength = 1; tabc.Note = textbox; } // panel var panel = new Panel(); if (browser != null) { panel.Controls.Add(browser); } else { panel.Controls.Add(textbox); } panel.Dock = DockStyle.Fill; panel.Location = new Point(3, 28); panel.Name = Guid.NewGuid().ToString(); panel.Padding = new Padding(0, 3, 0, 0); panel.Size = new Size(666, 461); // buttonback ToolStripButton buttonback = null; if (tabc.MyType == TabType.Forum || tabc.MyType == TabType.Log || tabc.MyType == TabType.Other) { buttonback = new ToolStripButton { Image = Resources._16x16_back, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(58, 22), Text = "Назад", ToolTipText = "Возврат на предыдущую страницу", Tag = browser }; buttonback.Click += buttonForumBack_Click; } // buttonrefresh ToolStripButton buttonrefresh = null; if ((tabc.MyType != TabType.Notepad) && (tabc.MyType != TabType.TodayChat)) { buttonrefresh = new ToolStripButton { Image = Resources._16x16_refresh, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(77, 22), Text = "Обновить", ToolTipText = "Обновление текущей страницы", Tag = browser }; buttonrefresh.Click += buttonForumRefresh_Click; } // buttonreload ToolStripButton buttonreload = null; if (tabc.MyType == TabType.TodayChat) { buttonreload = new ToolStripButton { Image = Resources._16x16_refresh, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(77, 22), Text = "Перечитать", ToolTipText = "Обновление сегодняшнего чата", Tag = browser }; buttonreload.Click += buttonReload_Click; } // buttonclose var buttonclose = new ToolStripButton { Image = Resources._16x16_close, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(71, 22), Text = "Закрыть", ToolTipText = "Закрытие этой закладки", Tag = tabpage }; buttonclose.Click += buttonForumClose_Click; // toolstripseparator1 ToolStripSeparator toolstripseparator1 = null; if (tabc.MyType != TabType.Notepad) { toolstripseparator1 = new ToolStripSeparator { Name = Guid.NewGuid().ToString(), Size = new Size(6, 25) }; } // buttoncompas ToolStripButton buttoncompas = null; if (tabc.MyType == TabType.PInfo || tabc.MyType == TabType.PName) { if (!string.IsNullOrEmpty(tourl)) { var nick = tabc.MyType == TabType.PInfo ? HelperConverters.NickDecode(tourl.Substring(Resources.AddressPInfo.Length)) : HelperConverters.NickDecode(tourl.Substring(Resources.AddressPName.Length)); buttoncompas = new ToolStripButton { Image = Resources._16x16_compas, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(64, 22), Text = "Компас", ToolTipText = "Поиск точного положения на природе", Tag = nick, Enabled = true }; buttoncompas.Click += buttonCompas_Click; } } // buttonprivate ToolStripButton buttonprivate = null; if (tabc.MyType == TabType.PInfo || tabc.MyType == TabType.PName) { if (!string.IsNullOrEmpty(tourl)) { var nick = tabc.MyType == TabType.PInfo ? HelperConverters.NickDecode(tourl.Substring(Resources.AddressPInfo.Length)) : HelperConverters.NickDecode(tourl.Substring(Resources.AddressPName.Length)); buttonprivate = new ToolStripButton { Image = Resources._16x16_private, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(64, 22), Text = "Приват", ToolTipText = "Обратиться в приват", Tag = nick }; buttonprivate.Click += buttonPrivate_Click; } } // buttoncontact ToolStripButton buttoncontact = null; if (tabc.MyType == TabType.PInfo || tabc.MyType == TabType.PName) { if (!string.IsNullOrEmpty(tourl)) { var nick = tabc.MyType == TabType.PInfo ? HelperConverters.NickDecode(tourl.Substring(Resources.AddressPInfo.Length)) : HelperConverters.NickDecode(tourl.Substring(Resources.AddressPName.Length)); buttoncontact = new ToolStripButton { Image = Resources._16x16_person, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(64, 22), Text = "В контакты", ToolTipText = "Добавить в контакты", Tag = nick }; buttoncontact.Click += buttonContact_Click; } } // buttonaddclan ToolStripButton buttonAddClan = null; if (tabc.MyType == TabType.PInfo || tabc.MyType == TabType.PName) { if (!string.IsNullOrEmpty(tourl)) { var nick = tabc.MyType == TabType.PInfo ? HelperConverters.NickDecode(tourl.Substring(Resources.AddressPInfo.Length)) : HelperConverters.NickDecode(tourl.Substring(Resources.AddressPName.Length)); buttonAddClan = new ToolStripButton { Image = Resources._16x16_person, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(64, 22), Text = @"Весь клан", ToolTipText = @"Добавление всего клана в контакты", Tag = nick, Enabled = true }; buttonAddClan.Click += buttonAddClan_Click; } } // buttonscreen ToolStripButton buttonscreen = null; if ((tabc.MyType != TabType.Notepad) && (tabc.MyType != TabType.TodayChat)) { buttonscreen = new ToolStripButton { Image = Resources._16x16_camera, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(64, 22), Text = "Снимок", ToolTipText = "Снимок текущей закладки", Tag = browser }; buttonscreen.Click += buttonForumScreen_Click; } // separator ToolStripSeparator toolstripseparator2 = null; if ((tabc.MyType != TabType.Notepad) && (tabc.MyType != TabType.TodayChat)) { toolstripseparator2 = new ToolStripSeparator { Name = Guid.NewGuid().ToString(), Size = new Size(6, 25) }; } // buttonaddress ToolStripButton buttonaddress = null; if ((tabc.MyType != TabType.Notepad) && (tabc.MyType != TabType.TodayChat)) { buttonaddress = new ToolStripButton { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Resources._16x16_copyurl, ImageTransparentColor = Color.Magenta, Name = Guid.NewGuid().ToString(), Size = new Size(23, 22), ToolTipText = "Копировать адрес в клипборд" }; buttonaddress.Click += buttonForumCopyAddress_Click; } // labeladdress ToolStripStatusLabel labeladdress = null; if ((tabc.MyType != TabType.Notepad) && (tabc.MyType != TabType.TodayChat)) { labeladdress = new ToolStripStatusLabel { Enabled = false, Name = Guid.NewGuid().ToString(), Size = new Size(65, 22), Text = tabc.AddressInit, TextAlign = ContentAlignment.MiddleLeft, DisplayStyle = ToolStripItemDisplayStyle.Text }; } if (browser != null) { browser.Tag = labeladdress; browser.DocumentCompleted += wbTab_DocumentCompleted; } // // toolstrip // var toolstrip = new ToolStrip(); switch (tabc.MyType) { case TabType.Other: case TabType.Log: case TabType.Forum: toolstrip.Items.AddRange(new ToolStripItem[] { buttonback, buttonrefresh, buttonclose, toolstripseparator1, buttonscreen, toolstripseparator2, buttonaddress, labeladdress }); break; case TabType.PBots: case TabType.Room: toolstrip.Items.AddRange(new ToolStripItem[] { buttonrefresh, buttonclose, toolstripseparator1, buttonscreen, toolstripseparator2, buttonaddress, labeladdress }); break; case TabType.PInfo: case TabType.PName: toolstrip.Items.AddRange(new ToolStripItem[] { buttonrefresh, buttonclose, toolstripseparator1, buttoncompas, buttonprivate, buttoncontact, buttonAddClan, buttonscreen, toolstripseparator2, buttonaddress, labeladdress }); break; case TabType.Notepad: toolstrip.Items.AddRange(new ToolStripItem[] { buttonclose }); break; case TabType.TodayChat: toolstrip.Items.AddRange(new ToolStripItem[] { buttonreload, buttonclose }); break; } toolstrip.Location = new Point(3, 3); toolstrip.Name = Guid.NewGuid().ToString(); toolstrip.Size = new Size(666, 25); tabpage.Controls.Add(panel); tabpage.Controls.Add(toolstrip); tabpage.Name = Guid.NewGuid().ToString(); tabpage.Location = new Point(4, 23); tabpage.Size = new Size(672, 492); tabpage.Padding = new Padding(3); tabpage.UseVisualStyleBackColor = true; switch (tt) { case TabType.Forum: tabpage.Text = "Форум"; break; case TabType.PInfo: if (tourl != null) { tabpage.Text = HelperConverters.NickDecode(tourl.Substring(Resources.AddressPInfo.Length)); tourl = HelperConverters.AddressEncode(Resources.AddressPInfo + tabpage.Text); } tabpage.ImageIndex = 0; break; case TabType.PName: if (tourl != null) { tabpage.Text = HelperConverters.NickDecode(tourl.Substring(Resources.AddressPName.Length)); tourl = HelperConverters.AddressEncode(Resources.AddressPName + tabpage.Text); } tabpage.ImageIndex = 0; break; case TabType.PBots: if (tourl != null) { tabpage.Text = "Бот " + tourl.Substring(Resources.AddressPBots.Length); } tabpage.ImageIndex = 0; break; case TabType.Log: if (tourl != null) { var slog = tourl.Substring(Resources.AddressFightLog.Length); var pos = slog.IndexOf('&'); if (pos != -1) { slog = slog.Substring(0, pos); } tabpage.Text = "Бой " + slog; } break; case TabType.Room: if (tourl != null) { tabpage.Text = "Комната " + tourl.Substring("http://www.neverlands.ru/ch.php?lo=1&r=".Length); } break; case TabType.Notepad: tabpage.Text = "Блокнот"; tabpage.ImageIndex = 1; break; case TabType.TodayChat: tabpage.Text = "Сегодняшний чат"; break; case TabType.Other: if (tourl != null) { tabpage.Text = new Uri(tourl).DnsSafeHost; } break; } if ((tt != TabType.Game) && (tt != TabType.Notepad) && (tt != TabType.TodayChat)) { if (!delayed) { tabc.WB.Navigate(tourl); } } if (tt == TabType.TodayChat) { if (!delayed) { TabReload(buttonreload); } } tabc.Address = tourl; tabpage.Tag = tabc; if ((tt == TabType.PInfo) && (tabpage.Text.Equals(AppVars.Profile.UserNick, StringComparison.OrdinalIgnoreCase))) { tabControlLeft.TabPages.Insert(1, tabpage); } else { tabControlLeft.TabPages.Add(tabpage); } if (delayed) { return; } SaveTabs(); tabControlLeft.SelectedTab = tabpage; }