-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (43 loc) · 1.12 KB
/
Program.cs
File metadata and controls
46 lines (43 loc) · 1.12 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
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace Dungeontest
{
#if WINDOWS || LINUX
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
ServerHost.IPv4 = getIPv4();
using (StreamWriter writer = new StreamWriter("debug.txt"))
{
//Console.SetOut(writer);
using (Dungeontest game = new Dungeontest())
game.Run();
}
}
/// <summary>
/// Grabs the player's IP
/// </summary>
/// <returns>Player's IP</returns>
public static string getIPv4()
{
IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress a in localIPs)
{
if (a.AddressFamily == AddressFamily.InterNetwork)
return a.ToString();
}
return "null";
}
}
#endif
}