You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-14 22:26:29 +09:00
transferred from trunk/Generation3 of lidgren-network
This commit is contained in:
46
Samples/ImageClient/Program.cs
Normal file
46
Samples/ImageClient/Program.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using SamplesCommon;
|
||||
using Lidgren.Network;
|
||||
|
||||
namespace ImageClient
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
public static Form1 MainForm;
|
||||
public static List<ImageGetter> Getters = new List<ImageGetter>();
|
||||
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
MainForm = new Form1();
|
||||
|
||||
Application.Idle += new EventHandler(AppLoop);
|
||||
Application.Run(MainForm);
|
||||
}
|
||||
|
||||
static void AppLoop(object sender, EventArgs e)
|
||||
{
|
||||
foreach (ImageGetter getter in Getters)
|
||||
getter.Text = "Client; " + getter.Client.Statistics.BytesAllocated + " bytes allocated";
|
||||
|
||||
while (NativeMethods.AppStillIdle)
|
||||
{
|
||||
foreach (ImageGetter getter in Getters)
|
||||
getter.Heartbeat();
|
||||
System.Threading.Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SpawnGetter(string host, NetPeerConfiguration copyConfig)
|
||||
{
|
||||
ImageGetter getter = new ImageGetter(host, copyConfig);
|
||||
Getters.Add(getter);
|
||||
getter.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user