private void LoadFromFile(string name, Tabs tabs) { Data.RemoteServerRcon serverData = new Data.RemoteServerRcon(); XmlSerializer serializer = new XmlSerializer(typeof(Data.RemoteServerRcon)); StreamReader reader = new StreamReader(Utils.Main.RemoteDirectory + name + Path.DirectorySeparatorChar + "RconData.xml"); serverData = (Data.RemoteServerRcon)serializer.Deserialize(reader); reader.Close(); rcon = RconClient.INSTANCE; rcon.setupStream(serverData.adress, serverData.port, serverData.password); text.Clear(); text.TextChanged += new EventHandler <TextChangedEventArgs>(Parsers.Log.Parse); foreach (Tab t in tabs.tabs) { if (t.control is RemoteConsole) { RemoteConsole c = (RemoteConsole)t.control; if (c.data == data) { tabs.SelectTab(t); return; } } } tabs.AddTab(name, this); logThread = new Thread(new ThreadStart(logThreadWork)); logThread.Start(); }
private void openMenu_Click(object sender, EventArgs e) { if (base.SelectedNode is FileNode) { FileNode i = (FileNode)base.SelectedNode; TextEditor te = new TextEditor(); te.Load(i.GetFile(), this.tabs); } else if (base.SelectedNode is RemoteFileNode) { RemoteFileNode i = (RemoteFileNode)base.SelectedNode; TextEditor te = new TextEditor(); te.Load(i, this.tabs); } else if (base.SelectedNode is ConsoleNode) { ConsoleNode node = (ConsoleNode)base.SelectedNode; Console console = new Console(); console.Load(node.Parent.GetServerData(), this.tabs); } else if (base.SelectedNode is RemoteConsoleNode) { RemoteConsoleNode node = (RemoteConsoleNode)base.SelectedNode; RemoteConsole console = new RemoteConsole(); console.Load(node.Parent.data, node.Parent.GetServerData().name, this.tabs); } else if (base.SelectedNode is PropertiesNode) { PropertiesNode node = (PropertiesNode)base.SelectedNode; PropertiesEditor editor = new PropertiesEditor(); editor.Load(this.tabs); } }