<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/LibraryTestSamples/UnconnectedSample/UnconnectedSample/Form1.cs<|end_filename|>
﻿using System;
using System.Windows.Forms;

namespace UnconnectedSample
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			uint port;
			if (UInt32.TryParse(textBox2.Text, out port) == false)
			{
				MessageBox.Show("Please fill in the port of the target peer");
				return;
			}

			Program.Send(textBox1.Text, (int)port, textBox3.Text);
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/LibraryTestSamples/ManySample/ManyClients/Client.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lidgren.Network;

namespace ManyClients
{
	public partial class Client : Form
	{
		private const double c_sendFrequency = 1.0;

		public NetClient Net;

		private double m_lastSent;

		public Client()
		{
			InitializeComponent();

			NetPeerConfiguration config = new NetPeerConfiguration("many");
#if DEBUG
			config.SimulatedLoss = 0.02f;
#endif
			Net = new NetClient(config);
			Net.Start();
			Net.Connect("localhost", 14242);
		}

		protected override void OnClosed(EventArgs e)
		{
			Net.Shutdown("closed");
		}

		internal void Shutdown()
		{
			Net.Shutdown("bye");
		}

		internal void Heartbeat()
		{
			NetIncomingMessage inc;
			while ((inc = Net.ReadMessage()) != null)
			{
				switch (inc.MessageType)
				{
					case NetIncomingMessageType.StatusChanged:
						NetConnectionStatus status = (NetConnectionStatus)inc.ReadByte();
						this.Text = status.ToString();
						break;
					case NetIncomingMessageType.ErrorMessage:
						this.Text = inc.ReadString();
						break;
				}
			}

			// send message?
			if (NetTime.Now > m_lastSent + c_sendFrequency)
			{
				var om = Net.CreateMessage();
				om.Write("Hi!");
				Net.SendMessage(om, NetDeliveryMethod.ReliableOrdered);
				m_lastSent = NetTime.Now;

				// also update title
#if DEBUG
				this.Text = Net.Statistics.SentBytes + " bytes sent; " + Net.Statistics.ReceivedBytes + " bytes received";
#else
				string str = Net.ServerConnection == null ? "No connection" : Net.ServerConnection.Status.ToString();
				if (this.Text != str)
					this.Text = str;
#endif
			}
		}

		private void button1_Click(object sender, EventArgs e)
		{
			var om = Net.CreateMessage();
			om.Write("Manual hi!");

			Net.SendMessage(om, NetDeliveryMethod.ReliableOrdered);
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/LibraryTestSamples/DurableSample/DurableClient/Program.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

using System.Threading;
using Lidgren.Network;
using SamplesCommon;
using System.Text;

namespace DurableClient
{
	static class Program
	{
		public static Form1 MainForm;
		public static NetClient Client;

		private static bool s_sendStuff;

		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			MainForm = new Form1();

			NetPeerConfiguration config = new NetPeerConfiguration("durable");
			config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
			Client = new NetClient(config);
			Client.Start();

			Application.Idle += new EventHandler(AppLoop);
			Application.Run(MainForm);

			Client.Shutdown("App exiting");
		}

		public static void Display(string text)
		{
			NativeMethods.AppendText(MainForm.richTextBox1, text);
		}

		private static double s_nextSendReliableOrdered;
		private static uint[] s_reliableOrderedNr = new uint[3];

		private static double s_nextSendSequenced;
		private static uint[] s_sequencedNr = new uint[3];

		private static double s_lastLabelUpdate;
		private const double kLabelUpdateFrequency = 0.25;

		static void AppLoop(object sender, EventArgs e)
		{
			while (NativeMethods.AppStillIdle)
			{
				NetIncomingMessage msg;
				while ((msg = Client.WaitMessage(1)) != null)
				{
					switch (msg.MessageType)
					{
						case NetIncomingMessageType.VerboseDebugMessage:
						case NetIncomingMessageType.DebugMessage:
						case NetIncomingMessageType.WarningMessage:
						case NetIncomingMessageType.ErrorMessage:
							Display(msg.ReadString());
							break;
						case NetIncomingMessageType.Data:
							Display("Received data?!");
							break;
						case NetIncomingMessageType.DiscoveryResponse:
							Display("Got discovery response from " + msg.SenderEndPoint);
							NetOutgoingMessage approval = Client.CreateMessage();
							approval.Write("durableschmurable");
							Client.Connect(msg.SenderEndPoint, approval);
							break;

						case NetIncomingMessageType.StatusChanged:
							NetConnectionStatus status = (NetConnectionStatus)msg.ReadByte();
							string reason = msg.ReadString();
							Display("New status: " + status + " (" + reason + ")");

							if (status == NetConnectionStatus.Connected)
							{
								// go
								s_sendStuff = true;
							}
							break;
					}
					Client.Recycle(msg);
				}

				if (s_sendStuff)
				{
					double now = NetTime.Now;

					float speed = 1.0f;

					float speedMultiplier = 1.0f / speed;

					int r = NetRandom.Instance.Next(3);
					if (now > s_nextSendReliableOrdered)
					{
						NetOutgoingMessage om = Client.CreateMessage(5);

						uint rv = s_reliableOrderedNr[r];
						s_reliableOrderedNr[r]++;

						om.Write(rv);

						Client.SendMessage(om, NetDeliveryMethod.ReliableOrdered, r);
						s_nextSendReliableOrdered = now + (NetRandom.Instance.NextSingle() * (0.01f * speedMultiplier)) + (0.005f * speedMultiplier);
					}

					if (now > s_nextSendSequenced)
					{
						NetOutgoingMessage om = Client.CreateMessage();

						uint v = s_sequencedNr[r];
						s_sequencedNr[r]++;
						om.Write(v);
						Client.SendMessage(om, NetDeliveryMethod.UnreliableSequenced, r);
						s_nextSendSequenced = now + (NetRandom.Instance.NextSingle() * (0.01f * speedMultiplier)) + (0.005f * speedMultiplier);
					}

					if (now > s_lastLabelUpdate + kLabelUpdateFrequency)
					{
						UpdateLabel();
						s_lastLabelUpdate = now;
					}
				}
			}
		}

		private static void UpdateLabel()
		{
			NetConnection conn = Client.ServerConnection;
			if (conn != null)
			{
				StringBuilder bdr = new StringBuilder();
				bdr.Append(Client.Statistics.ToString());
				bdr.Append(conn.Statistics.ToString());

				bdr.AppendLine("SENT Reliable ordered: " + s_reliableOrderedNr[0] + ", " + s_reliableOrderedNr[1] + ", " + s_reliableOrderedNr[2]);
				bdr.AppendLine("SENT Sequenced: " + s_sequencedNr[0] + ", " + s_sequencedNr[1] + ", " + s_sequencedNr[2]);
				// bdr.AppendLine("Unsent bytes: " + conn.q);
				MainForm.label1.Text = bdr.ToString();
			}
		}

		public static void Connect(string host)
		{
			//NetOutgoingMessage approval = Client.CreateMessage();
			//approval.Write("durableschmurable");
			// Client.Connect(host, 14242, approval);
			Client.DiscoverKnownPeer(host, 14242);
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/LibraryTestSamples/ManySample/ManyClients/Program.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using SamplesCommon;

namespace ManyClients
{
	static class Program
	{
		public static List<Client> Clients;

		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			Clients = new List<Client>();

			Application.Idle += new EventHandler(AppIdle);
			Application.Run(new Form1());

			foreach (var c in Clients)
				c.Shutdown();
		}

		static void AppIdle(object sender, EventArgs e)
		{
			while (NativeMethods.AppStillIdle)
			{
				foreach (var c in Clients)
					c.Heartbeat();
				System.Threading.Thread.Sleep(1);
			}
		}

		internal static void CreateClient()
		{
			Client client = new Client();
			client.Show();
			Clients.Add(client);
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/File stream sample/FileStreamClient/Program.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

using Lidgren.Network;
using SamplesCommon;
using System.IO;

namespace FileStreamClient
{
	static class Program
	{
		private static Form1 s_form;
		private static NetClient s_client;
		private static ulong s_length;
		private static ulong s_received;
		private static FileStream s_writeStream;
		private static int s_timeStarted;

		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			s_form = new Form1();

			NetPeerConfiguration config = new NetPeerConfiguration("filestream");
			s_client = new NetClient(config);
			s_client.Start();

			Application.Idle += new EventHandler(AppLoop);
			Application.Run(s_form);

			s_client.Shutdown("Application exiting");
		}

		static void AppLoop(object sender, EventArgs e)
		{
			while (NativeMethods.AppStillIdle)
			{
				NetIncomingMessage inc;
				while ((inc = s_client.ReadMessage()) != null)
				{
					switch (inc.MessageType)
					{
						case NetIncomingMessageType.Data:
							int chunkLen = inc.LengthBytes;
							if (s_length == 0)
							{
								s_length = inc.ReadUInt64();
								string filename = inc.ReadString();
								s_form.Text = "Starting...";
								s_writeStream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None);
								s_timeStarted = Environment.TickCount;
								break;
							}

							byte[] all = inc.ReadBytes(inc.LengthBytes);
							s_received += (ulong)all.Length;
							s_writeStream.Write(all, 0, all.Length);

							int v = (int)(((float)s_received / (float)s_length) * 100.0f);
							if (s_form.progressBar1.Value != v)
							{
								s_form.progressBar1.Value = v;
								int passed = Environment.TickCount - s_timeStarted;
								double psec = (double)passed / 1000.0;
								double bps = (double)s_received / psec;

								s_form.Text = NetUtility.ToHumanReadable((long)bps) + " per second";
							}

							if (s_received >= s_length)
							{
								int passed = Environment.TickCount - s_timeStarted;
								double psec = (double)passed / 1000.0;
								double bps = (double)s_received / psec;
								s_form.Text = "Done at " + NetUtility.ToHumanReadable((long)bps) + " per second";
								s_form.progressBar1.Value = 100;

								s_writeStream.Flush();
								s_writeStream.Close();
								s_writeStream.Dispose();

								s_client.Disconnect("Everything received, bye!");
							}
							break;
					}
					s_client.Recycle(inc);
				}
			}
		}

		internal static void Connect(string host, int port)
		{
			s_length = 0;
			s_received = 0;
			s_client.Connect(host, port);
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/LibraryTestSamples/SpeedSample/SpeedServer/Program.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Lidgren.Network;
using SamplesCommon;
using System.Threading;
using System.Text;

namespace SpeedTestServer
{
	static class Program
	{
		private static Form1 s_form;
		private static NetServer s_server;
		private static NetPeerSettingsWindow s_settingsWindow;

		private const double s_labelUpdateInterval = 0.5f;
		private static double s_lastLabelUpdate;

		private static long s_totalBytesReceived;
		private static long s_bpsBytes;
		private static long[] s_nextNumber = new long[256];

		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			s_form = new Form1();

			// set up network
			NetPeerConfiguration config = new NetPeerConfiguration("speedtest");
			config.MaximumConnections = 1;
			config.Port = 14242;
			s_server = new NetServer(config);

			Application.Idle += new EventHandler(Application_Idle);
			Application.Run(s_form);
		}

		private static void Output(string text)
		{
			NativeMethods.AppendText(s_form.richTextBox1, text);
		}

		private static void Application_Idle(object sender, EventArgs e)
		{
			while (NativeMethods.AppStillIdle)
			{
				NetIncomingMessage im;
				while ((im = s_server.ReadMessage()) != null)
				{
					// handle incoming message
					switch (im.MessageType)
					{
						case NetIncomingMessageType.DebugMessage:
						case NetIncomingMessageType.ErrorMessage:
						case NetIncomingMessageType.WarningMessage:
						case NetIncomingMessageType.VerboseDebugMessage:
							string text = im.ReadString();
							Output(text);
							break;
						case NetIncomingMessageType.StatusChanged:
							NetConnectionStatus status = (NetConnectionStatus)im.ReadByte();
							string reason = im.ReadString();
							Output(NetUtility.ToHexString(im.SenderConnection.RemoteUniqueIdentifier) + " " + status + ": " + reason);
							break;
						case NetIncomingMessageType.Data:

							long nr = im.ReadInt64();
							int slot = (int)im.DeliveryMethod + im.SequenceChannel;
							long expected = s_nextNumber[slot];
							switch (im.DeliveryMethod)
							{
								case NetDeliveryMethod.Unreliable:
									// anything is FINE
									break;
								case NetDeliveryMethod.UnreliableSequenced:
								case NetDeliveryMethod.ReliableSequenced:
									if (nr < expected)
										throw new NetException(im.DeliveryMethod.ToString() + " failed! Expected " + expected + " received " + nr);
									s_nextNumber[slot] = nr + 1;
									break;
								case NetDeliveryMethod.ReliableUnordered:
									// anything is fine, basically
									break;
								case NetDeliveryMethod.ReliableOrdered:
									if (expected != nr)
										throw new NetException(im.DeliveryMethod.ToString() + " failed! Expected " + expected + " received " + nr);
									s_nextNumber[slot] = nr + 1;
									break;
							}

							int len = im.LengthBytes;
							s_totalBytesReceived += len;
							s_bpsBytes += len;
							break;
						default:
							Output("Unhandled type: " + im.MessageType);
							break;
					}
					s_server.Recycle(im);
				}

				double now = NetTime.Now;
				if (now > s_lastLabelUpdate + s_labelUpdateInterval)
				{
					//
					// Update label
					//

					StringBuilder bdr = new StringBuilder();
					bdr.Append(s_server.Statistics.ToString());

					List<NetConnection> conns = s_server.Connections;
					if (conns.Count > 0)
						bdr.Append(conns[0].Statistics.ToString());

					bdr.AppendLine("Total bytes received: " + NetUtility.ToHumanReadable(s_totalBytesReceived));
					
					// calculate bytes per second
					double time = now - s_lastLabelUpdate;
					double bps = (double)s_bpsBytes / time;
					s_bpsBytes = 0;

					bdr.AppendLine("Bytes/second: " + NetUtility.ToHumanReadable((long)bps));

					s_form.label1.Text = bdr.ToString();

					s_lastLabelUpdate = now;
				}

				Thread.Sleep(0);
			}
		}

		// called by the UI
		public static void Start()
		{
			s_server.Start();
		}

		// called by the UI
		public static void Shutdown()
		{
			s_server.Shutdown("Requested by user");
		}

		// called by the UI
		public static void DisplaySettings()
		{
			if (s_settingsWindow != null && s_settingsWindow.Visible)
			{
				s_settingsWindow.Hide();
			}
			else
			{
				if (s_settingsWindow == null || s_settingsWindow.IsDisposed)
					s_settingsWindow = new NetPeerSettingsWindow("Speed test server settings", s_server);
				s_settingsWindow.Show();
			}
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/ImageSample/ImageServer/Form1.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SamplesCommon;

namespace ImageServer
{
	public partial class Form1 : Form
	{
		private NetPeerSettingsWindow m_settingsWindow;

		public Form1()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			if (m_settingsWindow == null)
			{
				m_settingsWindow = new NetPeerSettingsWindow("Image server settings", Program.Server);
				m_settingsWindow.Show();
			}
			else
			{
				m_settingsWindow.Close();
				m_settingsWindow = null;
			}
		}

		private void button2_Click(object sender, EventArgs e)
		{
			OpenFileDialog dlg = new OpenFileDialog();
			dlg.Filter = "Image files|*.png;*.jpg;*.jpeg";
			DialogResult res = dlg.ShowDialog();
			if (res != DialogResult.OK)
				return;
			Program.Start(dlg.FileName);
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/LibraryTestSamples/DurableSample/DurableServer/Program.cs<|end_filename|>
﻿using System;
using System.Threading;
using System.Windows.Forms;

using Lidgren.Network;

using SamplesCommon;
using System.Text;

namespace DurableServer
{
	static class Program
	{
		public static Form1 MainForm;
		public static NetServer Server;
		
		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			MainForm = new Form1();

			NetPeerConfiguration config = new NetPeerConfiguration("durable");
			config.Port = 14242;
			config.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
			config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
			config.EnableUPnP = true;
			Server = new NetServer(config);
			Server.Start();

			// attempt upnp port forwarding
			Server.UPnP.ForwardPort(14242, "Durable sample test");

			m_expectedReliableOrdered = new uint[3];
			m_reliableOrderedCorrect = new int[3];
			m_reliableOrderedErrors = new int[3];

			m_expectedSequenced = new uint[3];
			m_sequencedCorrect = new int[3];
			m_sequencedErrors = new int[3];

			Application.Idle += new EventHandler(AppLoop);
			Application.Run(MainForm);

			Server.Shutdown("App exiting");
		}

		private static void Display(string text)
		{
			NativeMethods.AppendText(MainForm.richTextBox1, text);
		}

		private static double m_lastLabelUpdate;
		private const double kLabelUpdateFrequency = 0.25;

		private static uint[] m_expectedReliableOrdered;
		private static int[] m_reliableOrderedCorrect;
		private static int[] m_reliableOrderedErrors;

		private static uint[] m_expectedSequenced;
		private static int[] m_sequencedCorrect;
		private static int[] m_sequencedErrors;

		static void AppLoop(object sender, EventArgs e)
		{
			while (NativeMethods.AppStillIdle)
			{
				NetIncomingMessage msg;
				while ((msg = Server.ReadMessage()) != null)
				{
					switch (msg.MessageType)
					{
						case NetIncomingMessageType.VerboseDebugMessage:
						case NetIncomingMessageType.DebugMessage:
						case NetIncomingMessageType.WarningMessage:
						case NetIncomingMessageType.ErrorMessage:
							Display(msg.ReadString());
							break;
						case NetIncomingMessageType.DiscoveryRequest:
							// just send a no-info response
							Server.SendDiscoveryResponse(null, msg.SenderEndPoint);
							break;
						case NetIncomingMessageType.ConnectionApproval:
							string ok = msg.ReadString();
							if (ok == "durableschmurable")
								msg.SenderConnection.Approve();
							else
								msg.SenderConnection.Deny("You didn't say the secret word!");
							break;
						case NetIncomingMessageType.StatusChanged:
							NetConnectionStatus status = (NetConnectionStatus)msg.ReadByte();
							string reason = msg.ReadString();
							Display("New status: " + status + " (" + reason + ")");
							break;
						case NetIncomingMessageType.Data:
							uint nr = msg.ReadUInt32();
							int chan = msg.SequenceChannel;
							switch (msg.DeliveryMethod)
							{
								case NetDeliveryMethod.ReliableOrdered:
									if (nr != m_expectedReliableOrdered[chan])
									{
										//Display("Expected " + m_expectedReliableOrdered[chan] + ", got " + nr);
										m_reliableOrderedErrors[chan]++;
										m_expectedReliableOrdered[chan] = nr + 1;
									}
									else
									{
										m_reliableOrderedCorrect[chan]++;
										m_expectedReliableOrdered[chan]++;
									}
									break;
								case NetDeliveryMethod.UnreliableSequenced:
									if (nr < m_expectedSequenced[chan])
										m_sequencedErrors[chan]++;
									else
										m_sequencedCorrect[chan]++;
									m_expectedSequenced[chan] = nr + 1;
									break;
								default:
									throw new Exception("Bad NetDeliveryMethod: " + msg.DeliveryMethod);
							}
							break;
					}
					Server.Recycle(msg);
				}
				Thread.Sleep(0);

				double now = NetTime.Now;
				if (now > m_lastLabelUpdate + kLabelUpdateFrequency)
				{
					UpdateLabel();
					m_lastLabelUpdate = now;
				}
			}
		}

		private static void UpdateLabel()
		{
			if (Server.ConnectionsCount < 1)
			{
				// don't update! Keep old...
				const string oldData = "(Note: OLD DATA - NO CONNECTIONS NOW)";
				if (!MainForm.label1.Text.EndsWith(oldData))
					MainForm.label1.Text += oldData;
			}
			else
			{
				StringBuilder bdr = new StringBuilder();
				bdr.AppendLine("Uptime: " + (NetTime.ToReadable(NetTime.Now)));
				bdr.Append(Server.Statistics.ToString());
				bdr.Append(Server.Connections[0].Statistics.ToString());
				bdr.AppendLine("RECEIVED Reliable ordered: " + 
					m_reliableOrderedCorrect[0] + ", " +
					m_reliableOrderedCorrect[1] + ", " +
					m_reliableOrderedCorrect[2] + 
					" received; " +
					m_reliableOrderedErrors[0] + ", " +
					m_reliableOrderedErrors[1] + ", " +
					m_reliableOrderedErrors[2] +
					" errors");
				bdr.AppendLine("RECEIVED Sequenced: " +
					m_sequencedCorrect[0] + ", " +
					m_sequencedCorrect[1] + ", " +
					m_sequencedCorrect[2] +
					" received; " +
					m_sequencedErrors[0] + ", " +
					m_sequencedErrors[1] + ", " +
					m_sequencedErrors[2] +
					" errors");
				MainForm.label1.Text = bdr.ToString();
			}
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/LibraryTestSamples/SpeedSample/SpeedClient/Form1.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SpeedTestClient
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
			comboBox1.SelectedIndex = 0;
		}

		private void button2_Click(object sender, EventArgs e)
		{
			int seqChan;
			Int32.TryParse(textBox3.Text, out seqChan);
			int port;
			Int32.TryParse(textBox2.Text, out port);
			Program.Connect(textBox1.Text, port, comboBox1.SelectedItem.ToString(), seqChan);
		}

		private void button1_Click(object sender, EventArgs e)
		{
			Program.DisplaySettings();
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/ImageSample/ImageClient/Form1.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lidgren.Network;
using SamplesCommon;

namespace ImageClient
{
	public partial class Form1 : Form
	{
		private NetPeer m_dummyPeer;
		private NetPeerConfiguration m_config;

		public Form1()
		{
			m_config = new NetPeerConfiguration("ImageTransfer");
			m_dummyPeer = new NetPeer(m_config);
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			Program.SpawnGetter(textBox1.Text, m_config);
		}

		private void button2_Click(object sender, EventArgs e)
		{
			NetPeerSettingsWindow win = new NetPeerSettingsWindow("Client settings", m_dummyPeer);
			win.Show();
		}
	}
}


<|start_filename|>hist_mmorpg-master/Libraries/lidgren-network-gen3-master/Samples/MasterServerSample/MSClient/Form1.cs<|end_filename|>
﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MSClient
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			Program.GetServerList(textBox1.Text);
		}

		private void button2_Click(object sender, EventArgs e)
		{
			if (comboBox1.SelectedItem == null)
				return;

			var splits = comboBox1.SelectedItem.ToString().Split(' ');
			var host = Int64.Parse(splits[0]);
			Program.RequestNATIntroduction(host);
		}
	}
}
