Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        internal unsafe void InitializeBaseInfoTablePointers(string fileName, bool fromAssembly)
        {
            if (fromAssembly)
            {
                this.m_pDataFileStart = GlobalizationAssembly.GetGlobalizationResourceBytePtr(typeof(BaseInfoTable).Assembly, fileName);
            }
            else
            {
                this.memoryMapFile = new AgileSafeNativeMemoryHandle(fileName);
                if (this.memoryMapFile.FileSize == 0L)
                {
                    this.m_valid = false;
                    return;
                }
                this.m_pDataFileStart = this.memoryMapFile.GetBytePtr();
            }
            EndianessHeader *pDataFileStart = (EndianessHeader *)this.m_pDataFileStart;

            this.m_pCultureHeader = (CultureTableHeader *)(this.m_pDataFileStart + pDataFileStart->leOffset);
            this.SetDataItemPointers();
        }
Ejemplo n.º 3
0
 internal unsafe void InitializeBaseInfoTablePointers(string fileName, bool fromAssembly)
 {
     if (fromAssembly)
     {
         this.m_pDataFileStart = GlobalizationAssembly.GetGlobalizationResourceBytePtr(typeof(BaseInfoTable).Assembly, fileName);
     }
     else
     {
         this.memoryMapFile = new AgileSafeNativeMemoryHandle(fileName);
         if (this.memoryMapFile.FileSize == 0L)
         {
             this.m_valid = false;
             return;
         }
         this.m_pDataFileStart = this.memoryMapFile.GetBytePtr();
     }
     EndianessHeader* pDataFileStart = (EndianessHeader*) this.m_pDataFileStart;
     this.m_pCultureHeader = (CultureTableHeader*) (this.m_pDataFileStart + pDataFileStart->leOffset);
     this.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();
        }