Exemplo n.º 1
0
        [System.Security.SecurityCritical]  // auto-generated
        static private unsafe void InitializeForm(NormalizationForm form, String strDataFile)
        {
#if FEATURE_COREFX_GLOBALIZATION
            //TODO: Implement this fully.  We might need a PAL here.
            throw new NotImplementedException();
#else
            byte *pTables = null;

            // Normalization uses OS on Win8
            if (!Environment.IsWindows8OrAbove)
            {
                if (strDataFile == null)
                {
                    // They were supposed to have a form that we know about!
                    throw new ArgumentException(
                              Environment.GetResourceString("Argument_InvalidNormalizationForm"));
                }

                // Tell the DLL where to find our data
                pTables = GlobalizationAssembly.GetGlobalizationResourceBytePtr(
                    typeof(Normalization).Assembly, strDataFile);
                if (pTables == null)
                {
                    // Unable to load the specified normalizationForm,
                    // tables not loaded from file
                    throw new ArgumentException(
                              Environment.GetResourceString("Argument_InvalidNormalizationForm"));
                }
            }

            nativeNormalizationInitNormalization(form, pTables);
#endif
        }
        static private unsafe void InitializeForm(NormalizationForm form, String strDataFile)
        {
            byte *pTables = null;

            // Normalization uses OS on Win8
            if (!Environment.IsWindows8OrAbove)
            {
                if (strDataFile == null)
                {
                    // They were supposed to have a form that we know about!
                    throw new ArgumentException(
                              Environment.GetResourceString("Argument_InvalidNormalizationForm"));
                }

                // Tell the DLL where to find our data
                pTables = GlobalizationAssembly.GetGlobalizationResourceBytePtr(
                    typeof(Normalization).Assembly, strDataFile);
                if (pTables == null)
                {
                    // Unable to load the specified normalizationForm,
                    // tables not loaded from file
                    throw new ArgumentException(
                              Environment.GetResourceString("Argument_InvalidNormalizationForm"));
                }
            }

            nativeNormalizationInitNormalization(form, pTables);
        }
Exemplo n.º 3
0
        private static unsafe void InitializeForm(NormalizationForm form, string strDataFile)
        {
            byte *pTableData = (byte *)null;

            if (!Environment.IsWindows8OrAbove)
            {
                if (strDataFile == null)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNormalizationForm"));
                }
                pTableData = GlobalizationAssembly.GetGlobalizationResourceBytePtr(typeof(Normalization).Assembly, strDataFile);
                if ((IntPtr)pTableData == IntPtr.Zero)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNormalizationForm"));
                }
            }
            Normalization.nativeNormalizationInitNormalization(form, pTableData);
        }
        internal unsafe Normalization(NormalizationForm form, string strDataFile)
        {
            this.normalizationForm = form;
            if (!nativeLoadNormalizationDLL())
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNormalizationForm"));
            }
            byte *globalizationResourceBytePtr = GlobalizationAssembly.GetGlobalizationResourceBytePtr(typeof(Normalization).Assembly, strDataFile);

            if (globalizationResourceBytePtr == null)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNormalizationForm"));
            }
            if (nativeNormalizationInitNormalization(form, globalizationResourceBytePtr) == null)
            {
                throw new OutOfMemoryException(Environment.GetResourceString("Arg_OutOfMemoryException"));
            }
        }
Exemplo n.º 5
0
        internal unsafe Normalization(NormalizationForm form, String strDataFile)
        {
            // Remember which form we are
            this.normalizationForm = form;
            // Load the DLL
            if (!nativeLoadNormalizationDLL())
            {
                // Unable to load the normalization DLL!
                throw new ArgumentException(
                          Environment.GetResourceString("Argument_InvalidNormalizationForm"));
            }

            // Tell the DLL where to find our data
            byte *pTables = GlobalizationAssembly.GetGlobalizationResourceBytePtr(
                typeof(Normalization).Assembly, strDataFile);

            if (pTables == null)
            {
                // Unable to load the specified normalizationForm,
                // tables not loaded from file
                throw new ArgumentException(
                          Environment.GetResourceString("Argument_InvalidNormalizationForm"));
            }

            // All we have to do is let the .dll know how to load it, then
            // we can ignore the returned pointer.
            byte *objNorm = nativeNormalizationInitNormalization(form, pTables);

            if (objNorm == null)
            {
                // Unable to load the specified normalizationForm
                // native library class not initialized correctly
                throw new OutOfMemoryException(
                          Environment.GetResourceString("Arg_OutOfMemoryException"));
            }
        }