1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Fix LineIncubator->LineExists()

This commit is contained in:
Starbeamrainbowlabs 2017-04-24 18:09:18 +01:00
parent 9cd578512b
commit 96485f3f0e
2 changed files with 20 additions and 11 deletions

View file

@ -39,7 +39,7 @@ namespace Nibriboard.Client
/// <param name="lineId">The line id to check for.</param> /// <param name="lineId">The line id to check for.</param>
public bool LineExists(string lineId) public bool LineExists(string lineId)
{ {
if(currentLines[lineId] != null) if(currentLines.ContainsKey(lineId))
return true; return true;
return false; return false;
} }

View file

@ -162,6 +162,8 @@ namespace Nibriboard.Client
if(eventName != "CursorPosition") if(eventName != "CursorPosition")
Log.WriteLine("[NibriClient#{0}] Recieved message with event {1}.", Id, eventName); Log.WriteLine("[NibriClient#{0}] Recieved message with event {1}.", Id, eventName);
try
{
Type messageType = messageEventTypes[eventName]; Type messageType = messageEventTypes[eventName];
Type jsonNet = typeof(JsonConvert); Type jsonNet = typeof(JsonConvert);
MethodInfo deserialiserInfo = jsonNet.GetMethods().First(method => method.Name == "DeserializeObject" && method.IsGenericMethod); MethodInfo deserialiserInfo = jsonNet.GetMethods().First(method => method.Name == "DeserializeObject" && method.IsGenericMethod);
@ -173,6 +175,13 @@ namespace Nibriboard.Client
MethodInfo handlerInfo = clientType.GetMethod(handlerMethodName, BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo handlerInfo = clientType.GetMethod(handlerMethodName, BindingFlags.Instance | BindingFlags.NonPublic);
await (Task)handlerInfo.Invoke(this, new object[] { decodedMessage }); await (Task)handlerInfo.Invoke(this, new object[] { decodedMessage });
} }
catch(Exception error)
{
Log.WriteLine("[NibriClient#{0}] Error decoding and / or handling message.", Id);
Log.WriteLine("[NibriClient#{0}] Raw frame content: {1}", Id, frame);
Log.WriteLine("[NibriClient#{0}] Exception details: {1}", Id, error);
}
}
#endregion #endregion