示例#1
0
 public static bool TryReadFrom(byte[] data, ref int index, out EightByteOscData value)
 {
     if (index + byteCount > data.Length)
     {
         value = new EightByteOscData();
         return(false);
     }
     value = new EightByteOscData(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 Vector2Int value)
        {
            // Try to get blob byte count.
            int byteCountPrefixValue;

            if (!TryReadAndEvaluateByteCountPrefix(data, index, out byteCountPrefixValue))
            {
                value = Vector2Int.zero;
                return(false);
            }
            index += FourByteOscData.byteCount;

            EightByteOscData valueData;

            if (!EightByteOscData.TryReadFrom(data, ref index, out valueData))
            {
                value = Vector2Int.zero;
                return(false);
            }
            value = valueData.vector2IntValue;
            return(true);
        }