Example #1
0
        internal unsafe void InitializeBaseInfoTablePointers(String fileName, bool fromAssembly)
        {
            if (fromAssembly)
            {
                m_pDataFileStart = GlobalizationAssembly.GetGlobalizationResourceBytePtr(typeof(BaseInfoTable).Assembly, fileName);
            }
            else
            {
                this.memoryMapFile = new MemoryMapFile(fileName);

                if (this.memoryMapFile.FileSize == 0)
                {
                    m_valid = false;
                    return;
                }

                this.m_pDataFileStart = this.memoryMapFile.GetBytePtr();
            }
            EndianessHeader *pEndianHeader = (EndianessHeader *)m_pDataFileStart;

            // Set up pointer to the CultureTableHeader

#if BIGENDIAN
            BCLDebug.Assert(pEndianHeader->beOffset != 0, "Big-Endian data is expected.");
            m_pCultureHeader = (CultureTableHeader *)(m_pDataFileStart + pEndianHeader->beOffset);
#else
            BCLDebug.Assert(pEndianHeader->leOffset != 0, "Little-Endian data is expected.");
            m_pCultureHeader = (CultureTableHeader *)(m_pDataFileStart + pEndianHeader->leOffset);
#endif

            // Set up misc pointers and variables.
            // Different data items for calendar and culture, so they each have their own setting thingy.
            SetDataItemPointers();
        }
        internal unsafe void InitializeBaseInfoTablePointers(String fileName, bool fromAssembly) {
            if (fromAssembly) {
                m_pDataFileStart = GlobalizationAssembly.GetGlobalizationResourceBytePtr(typeof(BaseInfoTable).Assembly, fileName);
            } else {
                this.memoryMapFile = new MemoryMapFile(fileName);

                if (this.memoryMapFile.FileSize == 0)
                {
                    m_valid = false;
                    return;
                }

                this.m_pDataFileStart = this.memoryMapFile.GetBytePtr();
            }
            EndianessHeader* pEndianHeader = (EndianessHeader*)m_pDataFileStart;

            // Set up pointer to the CultureTableHeader

#if BIGENDIAN
            BCLDebug.Assert(pEndianHeader->beOffset != 0, "Big-Endian data is expected.");
            m_pCultureHeader = (CultureTableHeader*)(m_pDataFileStart + pEndianHeader->beOffset);
#else
            BCLDebug.Assert(pEndianHeader->leOffset != 0, "Little-Endian data is expected.");
            m_pCultureHeader = (CultureTableHeader*)(m_pDataFileStart + pEndianHeader->leOffset);
#endif

            // Set up misc pointers and variables.
            // Different data items for calendar and culture, so they each have their own setting thingy.
            SetDataItemPointers();
        }