// TODO When .Net 4.5 becomes available in Unity: Replace IList<T> with IReadOnlyList<T> since we want to pass Array where number and order of list elements is read-only. public static bool TryReadFrom(byte[] data, ref int index, out TwelveByteOscData value) { if (index + byteCount > data.Length) { value = new TwelveByteOscData(); return(false); } value = new TwelveByteOscData( data[index++], data[index++], data[index++], data[index++], data[index++], data[index++], data[index++], data[index++], data[index++], data[index++], data[index++], data[index++] ); return(true); }
public static bool TryReadFrom(byte[] data, ref int index, out Vector3Int value) { // Try to get blob byte count. int byteCountPrefixValue; if (!TryReadAndEvaluateByteCountPrefix(data, index, out byteCountPrefixValue)) { value = Vector3Int.zero; return(false); } index += FourByteOscData.byteCount; TwelveByteOscData valueData; if (!TwelveByteOscData.TryReadFrom(data, ref index, out valueData)) { value = Vector3Int.zero; return(false); } value = valueData.vector3IntValue; return(true); }