json config file
This commit is contained in:
parent
f0ccd7be48
commit
7142e57a4a
@ -1,4 +1,5 @@
|
||||
using BuildSoft.OscCore;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace VRC_Console;
|
||||
|
||||
@ -7,7 +8,22 @@ public class OSCCollar
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
OSCCollar collar = new OSCCollar();
|
||||
string configFilePath = Path.Combine(Directory.GetCurrentDirectory(), "config.json");
|
||||
if (File.Exists(configFilePath))
|
||||
{
|
||||
var jObject = JObject.Parse(File.ReadAllText(configFilePath));
|
||||
string ip = jObject.GetValue("ip")?.ToObject<string>() ?? "127.0.0.1";
|
||||
int portReceive = jObject.GetValue("portReceive")?.ToObject<int>() ?? 9001;
|
||||
int portSend = jObject.GetValue("portReceive")?.ToObject<int>() ?? 9000;
|
||||
double radius = jObject.GetValue("radius")?.ToObject<int>() ?? 100;
|
||||
double calibrationX = jObject.GetValue("calibrationX")?.ToObject<int>() ?? 0;
|
||||
double calibrationY = jObject.GetValue("calibrationY")?.ToObject<int>() ?? 0;
|
||||
bool skipSetup = jObject.GetValue("skipSetup")?.ToObject<bool>() ?? true;
|
||||
var _ = new OSCCollar(ip, portReceive, portSend, radius, calibrationX, calibrationY, skipSetup);
|
||||
}else
|
||||
{
|
||||
var _ = new OSCCollar();
|
||||
}
|
||||
}
|
||||
|
||||
private OscServer Server { get; init; }
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BuildSoft.OscCore" Version="1.2.1.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user