forked from filipmaj1/CapcomDirectServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
42 lines (38 loc) · 1.29 KB
/
Program.cs
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
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
namespace FMaj.CapcomDirectServer
{
class Program
{
public const int PORT_START = 8888;
public static readonly Logger Log = LogManager.GetCurrentClassLogger();
static void Main(string[] args)
{
Log.Info("=============================");
Log.Info("Capcom Direct Server");
Log.Info("=============================");
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Server server = new Server();
server.StartServer(PORT_START);
while (true) {
string input = Console.ReadLine();
if (input.StartsWith('!'))
{
server.SendAll(Encoding.ASCII.GetBytes(input.Substring(1)));
} else if (input.StartsWith('@'))
{
try
{
byte[] data = File.ReadAllBytes(".\\" + input.Substring(1));
server.SendAll(data);
}catch (IOException) { Console.WriteLine("> File not found"); }
}
Thread.Sleep(200);
};
}
}
}