Sorgente Release 1 (Codename "Campra")
This commit is contained in:
37
SamaPager_Server/ConfigManager.cs
Normal file
37
SamaPager_Server/ConfigManager.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace SamaPager_Server
|
||||
{
|
||||
internal class ConfigManager
|
||||
{
|
||||
internal string FileName = "config.json";
|
||||
internal string ListeningIP { get; set; }
|
||||
internal int ListeningPort { get; set; }
|
||||
|
||||
internal ConfigManager(string fileName)
|
||||
{
|
||||
this.FileName = fileName;
|
||||
|
||||
if (!File.Exists(FileName))
|
||||
{
|
||||
ListeningIP = "0.0.0.0";
|
||||
ListeningPort = 2000;
|
||||
}
|
||||
else
|
||||
{
|
||||
string rawJson = File.ReadAllText(FileName);
|
||||
ConfigManager config = JsonConvert.DeserializeObject<ConfigManager>(rawJson);
|
||||
ListeningIP = config.ListeningIP;
|
||||
ListeningPort = config.ListeningPort;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user