public MainWindow() { try { InitializeComponent(); //Opcode Section PacketTranslator.Init(); pp = new PacketProcessor(this); cap = new Capture(this); filter = new PacketFilter(); pp.Init(); //Serverlist List <ServerInfo> servers = MiscFuncs.LoadServerlistFile(Directory.GetCurrentDirectory() + "\\serverlist.xml"); if (servers != null && servers.Count > 0) { //We got a custom serverlist.xml loaded.... boxServers.Items.Clear(); foreach (var server in servers) { ComboBoxItem item = new ComboBoxItem { Tag = server, Content = server.ToString() }; int index = boxServers.Items.Add(item); if (server.Focus) { boxServers.SelectedIndex = index; } if (server.AutoStart) { btnStartStop_Click(null, null); } } } //Print Info string info = String.Format("Loaded {0} Opcodes. \n" + "Loaded {1} servers.\n" + "Github of this Project: https://github.com/GoneUp/Tera_PacketViewer\n" + "Released at Ragezone: http://forum.ragezone.com/f797/release-tera-live-packet-sniffer-1052922/\n" + "Uses code of the TeraDamageMeter by gothos-folly: https://github.com/gothos-folly/TeraDamageMeter\n" + "Have Fun ;)", PacketTranslator.PacketNames.Count, boxServers.Items.Count); SetText(info); } catch (Exception ex) { string info = "Startup FAIL! Is WinPcap installed? \n " + ex; SetText(info); } }
public MainWindow() { try { InitializeComponent(); //Opcode Section PacketTranslator.Init(this); IEnumerable <string> sortDescendingQuery = from w in PacketTranslator.PacketNames.Values orderby w ascending select w; foreach (var packetName in sortDescendingQuery) { PacketNamesList.Items.Add(packetName); } PacketNamesList.SelectedIndex = 0; //Serverlist List <ServerInfo> servers = MiscFuncs.LoadServerlistFile(Directory.GetCurrentDirectory() + "\\serverlist.xml"); if (servers != null && servers.Count > 0) { //We got a custom serverlist.xml loaded.... BoxServers.Items.Clear(); foreach (var server in servers) { int index = BoxServers.Items.Add(server.GetDisplayString()); if (server.Focus) { BoxServers.SelectedIndex = index; } } } //Capture pp = new PacketProcessor(this); cap = new Capture.Capture(this); var list = cap.GetDevices(); foreach (var nic in list) { BoxNic.Items.Add(nic); } pp.Init(); //Print Info string info = String.Format("Loaded {0} Opcodes. \n" + "Loaded {1} servers.\n" + "{2} network devices available.\n" + "Github of this Project: https://github.com/GoneUp/Tera_PacketViewer\n" + "Released at Ragezone: http://forum.ragezone.com/f797/release-tera-live-packet-sniffer-1052922/\n" + "Have Fun ;)", PacketNamesList.Items.Count, BoxServers.Items.Count, BoxNic.Items.Count); SetText(info); } catch (Exception ex) { string info = "Startup FAIL! Is WinPcap installed? \n " + ex; SetText(info); } }