コード例 #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())));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 private static string ReadName(MiNum <sbyte> element)
 {
     return(Encoding.ASCII.GetString(element.Data.Select(x => (byte)x).ToArray()));
 }
コード例 #5
0
 private static int[] ReadDimensionsArray(MiNum <int> element)
 {
     return(element.Data);
 }