Keep running thread
This commit is contained in:
parent
01b5a4945f
commit
8b374e73a9
10
CS2GSI.cs
10
CS2GSI.cs
@ -26,7 +26,13 @@ public class CS2GSI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._gsiServer = new GSIServer(3000);
|
this._gsiServer = new GSIServer(3000);
|
||||||
this._gsiServer.OnMessage += messageJson =>
|
this._gsiServer.OnMessage += GsiServerOnOnMessage;
|
||||||
|
|
||||||
|
while(this._gsiServer.IsRunning)
|
||||||
|
Thread.Sleep(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GsiServerOnOnMessage(string messageJson)
|
||||||
{
|
{
|
||||||
JObject jsonObject = JObject.Parse(messageJson);
|
JObject jsonObject = JObject.Parse(messageJson);
|
||||||
CS2GameState newState = CS2GameState.ParseFromJObject(jsonObject);
|
CS2GameState newState = CS2GameState.ParseFromJObject(jsonObject);
|
||||||
@ -43,9 +49,9 @@ public class CS2GSI
|
|||||||
InvokeEvents(generatedEvents);
|
InvokeEvents(generatedEvents);
|
||||||
}
|
}
|
||||||
_allGameStates.Add(newState);
|
_allGameStates.Add(newState);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void InvokeEvents(List<ValueTuple<CS2Event, CS2EventArgs>> cs2Events)
|
private void InvokeEvents(List<ValueTuple<CS2Event, CS2EventArgs>> cs2Events)
|
||||||
{
|
{
|
||||||
foreach(ValueTuple<CS2Event, CS2EventArgs> cs2Event in cs2Events)
|
foreach(ValueTuple<CS2Event, CS2EventArgs> cs2Event in cs2Events)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user