internal bool LoadFromFile(
            Collection <PSSnapInTypeAndFormatErrors> files,
            MshExpressionFactory expressionFactory,
            bool acceptLoadingErrors,
            AuthorizationManager authorizationManager,
            PSHost host,
            out List <XmlLoaderLoggerEntry> logEntries)
        {
            if (this.isShared)
            {
                throw TypeInfoDataBaseManager.tracer.NewInvalidOperationException("FormatAndOut.XmlLoading", "SharedFormattableCannotBeUpdated");
            }
            bool success;

            try
            {
                TypeInfoDataBase typeInfoDataBase = (TypeInfoDataBase)null;
                lock (this.updateDatabaseLock)
                    typeInfoDataBase = TypeInfoDataBaseManager.LoadFromFileHelper(files, expressionFactory, authorizationManager, host, out logEntries, out success);
                lock (this.databaseLock)
                {
                    if (!acceptLoadingErrors)
                    {
                        if (!success)
                        {
                            goto label_15;
                        }
                    }
                    this.dataBase = typeInfoDataBase;
                }
            }
            finally
            {
                lock (this.databaseLock)
                {
                    if (this.dataBase == null)
                    {
                        TypeInfoDataBase db = new TypeInfoDataBase();
                        TypeInfoDataBaseManager.AddPreLoadInstrinsics(db);
                        TypeInfoDataBaseManager.AddPostLoadInstrinsics(db);
                        this.dataBase = db;
                    }
                }
            }
label_15:
            return(success);
        }
        private static TypeInfoDataBase LoadFromFileHelper(
            Collection <PSSnapInTypeAndFormatErrors> files,
            MshExpressionFactory expressionFactory,
            AuthorizationManager authorizationManager,
            PSHost host,
            out List <XmlLoaderLoggerEntry> logEntries,
            out bool success)
        {
            success    = true;
            logEntries = new List <XmlLoaderLoggerEntry>();
            List <XmlFileLoadInfo> xmlFileLoadInfoList = new List <XmlFileLoadInfo>();

            foreach (PSSnapInTypeAndFormatErrors file in files)
            {
                xmlFileLoadInfoList.Add(new XmlFileLoadInfo(Path.GetPathRoot(file.FullPath), file.FullPath, file.Errors, file.PSSnapinName));
            }
            TypeInfoDataBase db = new TypeInfoDataBase();

            TypeInfoDataBaseManager.AddPreLoadInstrinsics(db);
            foreach (XmlFileLoadInfo info in xmlFileLoadInfoList)
            {
                using (TypeInfoDataBaseLoader infoDataBaseLoader = new TypeInfoDataBaseLoader())
                {
                    if (!infoDataBaseLoader.LoadXmlFile(info, db, expressionFactory, authorizationManager, host))
                    {
                        success = false;
                    }
                    foreach (XmlLoaderLoggerEntry logEntry in infoDataBaseLoader.LogEntries)
                    {
                        if (logEntry.entryType == XmlLoaderLoggerEntry.EntryType.Error)
                        {
                            string str = XmlLoadingResourceManager.FormatString("MshSnapinQualifiedError", (object)info.psSnapinName, (object)logEntry.message);
                            info.errors.Add(str);
                        }
                    }
                    logEntries.AddRange((IEnumerable <XmlLoaderLoggerEntry>)infoDataBaseLoader.LogEntries);
                }
            }
            TypeInfoDataBaseManager.AddPostLoadInstrinsics(db);
            return(db);
        }