Пример #1
0
        private static MatCharArrayOf <byte> ConvertToMatCharArray(
            ArrayFlags flags,
            int[] dimensions,
            string name,
            MiNum <byte> dataElement)
        {
            var data = dataElement.Data;

            return(new MatCharArrayOf <byte>(flags, dimensions, name, data, Encoding.UTF8.GetString(data)));
        }
Пример #2
0
        private static MatCharArrayOf <ushort> ConvertToMatCharArray(
            ArrayFlags flags,
            int[] dimensions,
            string name,
            MiNum <ushort> dataElement)
        {
            var data = dataElement.Data;

            return(new MatCharArrayOf <ushort>(
                       flags,
                       dimensions,
                       name,
                       data,
                       new string(data.Select(x => (char)x).ToArray())));
        }
        private static string[] ReadFieldNames(MiNum <sbyte> element, int fieldNameLength)
        {
            var numberOfFields = element.Data.Length / fieldNameLength;
            var result         = new string[numberOfFields];

            for (var i = 0; i < numberOfFields; i++)
            {
                var list     = new List <byte>();
                var position = i * fieldNameLength;
                while (element.Data[position] != 0)
                {
                    list.Add((byte)element.Data[position]);
                    position++;
                }

                result[i] = Encoding.ASCII.GetString(list.ToArray());
            }

            return(result);
        }
 private static string ReadName(MiNum <sbyte> element)
 {
     return(Encoding.ASCII.GetString(element.Data.Select(x => (byte)x).ToArray()));
 }
 private static int[] ReadDimensionsArray(MiNum <int> element)
 {
     return(element.Data);
 }