forked from DarkActive/PVPNetConnect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
48 lines (43 loc) · 1.58 KB
/
Program.cs
File metadata and controls
48 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Threading;
namespace PVPNetConnect
{
class Program
{
static void OnConnect(object sender, EventArgs eventArguments)
{
Console.WriteLine("OnConnect");
}
static void OnDisconnect(object sender, EventArgs eventArguments)
{
Console.WriteLine("OnDisconnect");
}
static void OnLogin(object sender, string username, string ipAddress)
{
Console.WriteLine("OnLogin");
PVPNetConnection connection = (PVPNetConnection)sender;
DateTime start = DateTime.Now;
const int Repetitions = 10;
int counter = 0;
for (int i = 0; i < Repetitions; i++)
{
}
while (counter < Repetitions)
Thread.Sleep(0);
TimeSpan duration = DateTime.Now - start;
Console.WriteLine("Duration: {0} ms", duration.TotalMilliseconds);
}
static void Main(string[] arguments)
{
if (arguments.Length != 3)
throw new Exception(string.Format("Invalid argument count: {0}", arguments.Length));
PVPNetConnection connection = new PVPNetConnection();
connection.OnConnect += OnConnect;
connection.OnLogin += OnLogin;
connection.OnDisconnect += OnDisconnect;
connection.Connect(arguments[0], arguments[1], Region.NA, arguments[2]);
ManualResetEvent terminationEvent = new ManualResetEvent(false);
terminationEvent.WaitOne();
}
}
}