コード例 #1
0
        private void InitializeFromFileHeader(string fileName)
        {
            using (s_cpu_AaraDataReadMemoryStream.Timer)
            {
                var typeNameLength = Load.AsByteArray(fileName, 0, 1)[0];

                var dataType = new string(Load.AsByteArray(fileName, 1, typeNameLength)
                                          .Select(b => (char)b).ToArray());

                var dimensions = Load.AsByteArray(fileName, 1 + typeNameLength, 1)[0];

                // Size
                var elementCount = 1;
                var size         = new int[dimensions];
                for (var i = 0; i < dimensions; i++)
                {
                    elementCount *= size[i] = BitConverter.ToInt32(
                        Load.AsByteArray(fileName, 2 + typeNameLength + i * sizeof(int), sizeof(int)),
                        0);
                }

                // -- set AaraData --
                SourceFileName   = fileName;
                DataTypeAsSymbol = dataType;
                ElementCount     = elementCount;
                Size             = size;
                HeaderSize       = 1 + typeNameLength + 1 + dimensions * sizeof(int);
            }
        }