public static HumanInputSnapshot Deserialize(byte[] input) { if (input == null || input.Length == 0) return null; HumanInputSnapshot result = new HumanInputSnapshot(); ComposedByteStream stream = ComposedByteStream.FromByteArray(input); if (stream == null) return null; int iMax = stream.streamCount; result.providersData = new HumanInputProviderData[iMax]; for (int i = 0; i < iMax; i++) result.providersData[i] = HumanInputProviderData.Deserialize(stream.ReadNextStream<byte>()); stream.Dispose(); return result; }
//--------------- Serialize / Deserialize -------------------- public static byte[] Serialize(HumanInputSnapshot input) { if (input == null) return null; ComposedByteStream stream = ComposedByteStream.FetchStream(); foreach (HumanInputProviderData data in input.providersData) stream.AddStream(HumanInputProviderData.Serialize(data)); return stream.Compose(); }
//Todo:Add material data and make all dispose calls recursive. public override void Dispose() { base.Dispose(); if (header != null) header.Dispose(); if (systemInfo != null) systemInfo.Dispose(); if (debugLogs != null) debugLogs.Dispose(); if (humanInput != null) humanInput.Dispose(); if (meshData != null) meshData.Dispose(); if (particleData != null) particleData.Dispose(); if (materialData != null) materialData.Dispose(); if (gameObjectsSnapshot != null) gameObjectsSnapshot.Dispose(); header = null; systemInfo = null; debugLogs = null; humanInput = null; meshData = null; particleData = null; materialData = null; gameObjectsSnapshot = null; screenCapture = null; }