SafeNet/.svn/pristine/78/78ee8d72da51ddfefd665d737e77b5ab1d8a0ac8.svn-base

58 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2021-02-24 11:50:23 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.IO;
using System.Collections;
using System.Threading;
using System.Net;
using Nini.Config;
namespace Simulator
{
class Program
{
private static ArrayList unitlist = new ArrayList();
private static IConfigSource source = null;
private static string CFG_FILE = "config.ini";
public static string UDP_IP = "";
public static int UDP_PORT = 0;
private static int TCP_PORT = 0;
static void Main(string[] args)
{
Console.WriteLine("Connect PLUS simulator!!!");
LoadConfig();
CTRL ctrl = new CTRL(TCP_PORT);
//INFINIT LOOP
while (true)
{
System.Threading.Thread.Sleep(1);
String t = Console.ReadLine();
if (t == "0") break;
}
}
static void LoadConfig()
{
try
{
source = new IniConfigSource(CFG_FILE);
UDP_IP = source.Configs["UDP"].Get("IP");
UDP_PORT = Convert.ToInt32(source.Configs["UDP"].Get("PORT"));
TCP_PORT = Convert.ToInt32(source.Configs["TCP"].Get("PORT"));
}
catch (Exception ex)
{
Console.WriteLine("LoadSetup() Exception: " + ex.ToString());
}
Console.WriteLine("LoadSetup file OK !");
}
}
}