Ejemplo n.º 1
0
        /// <summary>
        /// Parses the Meta Header from a byte array.
        /// </summary>
        /// <param name="data"></param>
        /// <param name="bytePointerPosition"></param>
        /// <param name="showConsole"></param>
        public MSV5(BinaryReader reader, bool showConsole = true)
        {
            mMetaStreamVersion      += ByteFunctions.ReadFixedString(reader, 4); //Meta Stream Keyword [4 bytes]
            mDefaultSectionChunkSize = reader.ReadUInt32();                      //Default Section Chunk Size [4 bytes] //default section chunk size
            mDebugSectionChunkSize   = reader.ReadUInt32();                      //Debug Section Chunk Size [4 bytes] //debug section chunk size (always zero)
            mAsyncSectionChunkSize   = reader.ReadUInt32();                      //Async Section Chunk Size [4 bytes] //async section chunk size (size of the bytes after the file header)
            mClassNamesLength        = reader.ReadUInt32();                      //mClassNamesLength [4 bytes]

            //--------------------------mClassNames--------------------------
            mClassNames = new ClassNames[mClassNamesLength];

            for (int i = 0; i < mClassNames.Length; i++)
            {
                mClassNames[i] = new ClassNames()
                {
                    mTypeNameCRC = new Symbol()
                    {
                        mCrc64 = reader.ReadUInt64()
                    },
                    mVersionCRC = reader.ReadUInt32()
                };
            }

            MetaHeaderLength = (4 * 5) + (12 * mClassNamesLength);

            if (showConsole)
            {
                ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.Cyan);
                Console.WriteLine("||||||||||| Meta Header |||||||||||");
                ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.White);
                Console.WriteLine("Meta Stream Keyword = {0}", mMetaStreamVersion);
                Console.WriteLine("Meta Default Section Chunk Size = {0}", mDefaultSectionChunkSize);
                Console.WriteLine("Meta Debug Section Chunk Size = {0}", mDebugSectionChunkSize);
                Console.WriteLine("Meta Async Section Chunk Size = {0}", mAsyncSectionChunkSize);
                Console.WriteLine("Meta mClassNamesLength = {0}", mClassNamesLength);

                for (int i = 0; i < mClassNames.Length; i++)
                {
                    Console.WriteLine("Meta mClassName {0} = {1}", i, mClassNames[i]);
                }
            }
        }
        /// <summary>
        /// Parses the Meta Header from a byte array.
        /// </summary>
        /// <param name="data"></param>
        /// <param name="bytePointerPosition"></param>
        /// <param name="showConsole"></param>
        public MTRE(BinaryReader reader, bool showConsole = true)
        {
            mMetaStreamVersion += ByteFunctions.ReadFixedString(reader, 4); //Meta Stream Keyword [4 bytes]
            mClassNamesLength   = reader.ReadUInt32();                      //mClassNamesLength [4 bytes]

            //--------------------------mClassNames--------------------------
            mClassNames = new ClassNames[mClassNamesLength];

            for (int i = 0; i < mClassNames.Length; i++)
            {
                mClassNames[i] = new ClassNames()
                {
                    mTypeNameCRC = new Symbol()
                    {
                        mCrc64 = reader.ReadUInt64()
                    },
                    mVersionCRC = reader.ReadUInt32()
                };
            }

            MetaHeaderLength = (4 * 5) + (12 * mClassNamesLength);

            if (showConsole)
            {
                ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.Cyan);
                Console.WriteLine("||||||||||| Meta Header |||||||||||");
                ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.White);
                Console.WriteLine("Meta Stream Keyword = {0}", mMetaStreamVersion);
                Console.WriteLine("Meta mClassNamesLength = {0}", mClassNamesLength);

                for (int i = 0; i < mClassNames.Length; i++)
                {
                    Console.WriteLine("Meta mClassName {0} = {1}", i, mClassNames[i]);
                }
            }
        }