/// <summary> /// Message deserialization an initiation of handling methods. /// </summary> /// <param name="serializedData">Message string containing data.</param> private void GetData(string serializedData) { // don't need to handle empty messages if (string.IsNullOrEmpty(serializedData)) { return; } try { // convert package string into stub NetworkPackageStub stub = JsonConvert.DeserializeObject <NetworkPackageStub>(serializedData); // check if calltype belongs to a known message type Type type; if (!m_PackageTypes.TryGetValue(stub.call, out type)) { AciLog.LogFormat(LogType.Error, GetType().ToString(), "Can't handle NetworkPackage with calltype \"{0}\".", stub.call); return; } // deserialize into package instance INetworkPackage package = JsonConvert.DeserializeObject(serializedData, type) as INetworkPackage; // call handler mathods UnityMainThreadDispatcher.Instance().Enqueue(() => m_PackageRegistry.Handle(package)); } catch (Exception e) { AciLog.LogException(e); } }
public void SendException() { AciLog.LogException(new Exception("This is a test exception.")); }