Пример #1
0
        /// <summary>
        /// Reads schema version from the stream on the fly inside the parser so it doesn't need to
        /// access the file twice.
        /// </summary>
        /// <param name="stream">Input stream for step21 text file</param>
        /// <param name="logger">Logger</param>
        /// <param name="progressDel">Progress delegate</param>
        /// <param name="ignoreTypes">A list of ifc types to skip</param>
        /// <param name="allowMissingReferences">Allow referenced entities that are not in the model, default false</param>
        /// <param name="keepOrder">When true, serialised file will maintain order of entities from the original file (or order of creation)</param>
        /// <returns>New memory model</returns>
        public static MemoryModel OpenReadStep21(Stream stream, ILogger logger    = null, ReportProgressDelegate progressDel = null,
                                                 IEnumerable <string> ignoreTypes = null, bool allowMissingReferences        = false, bool keepOrder = true)
        {
            var model = new MemoryModel((IEnumerable <string> schemas) =>
            {
                var schema = GetStepFileXbimSchemaVersion(schemas);
                return(GetFactory(schema));
            }, logger)
            {
                AllowMissingReferences = allowMissingReferences
            };

            if (!keepOrder)
            {
                model.DiscardNaturalOrder();
            }
            long len = -1;

            try
            {
                len = stream.Length;
            }
            catch (Exception)
            {
                // if lenght is not supported use len as previously set;
            }

            model.LoadStep21(stream, len, progressDel, ignoreTypes);
            return(model);
        }
Пример #2
0
        /// <summary>
        /// Reads schema version fron the stream on the fly inside the parser so it doesn't need to
        /// access the file twice.
        /// </summary>
        /// <param name="stream">Input stream for step21 text file</param>
        /// <param name="logger">Logger</param>
        /// <param name="progressDel">Progress delegate</param>
        /// <param name="ignoreTypes">A list of ifc types to skip</param>
        /// <returns>New memory model</returns>
        public static MemoryModel OpenReadStep21(Stream stream, ILogger logger    = null, ReportProgressDelegate progressDel = null,
                                                 IEnumerable <string> ignoreTypes = null)
        {
            var model = new MemoryModel((IEnumerable <string> schemas) =>
            {
                var schema = GetStepFileXbimSchemaVersion(schemas);
                return(GetFactory(schema));
            }, logger);

            model.LoadStep21(stream, stream.Length, progressDel, ignoreTypes);
            return(model);
        }
Пример #3
0
        /// <summary>
        /// Reads schema version from the stream on the fly inside the parser so it doesn't need to
        /// access the file twice.
        /// </summary>
        /// <param name="stream">Input stream for step21 text file</param>
        /// <param name="logger">Logger</param>
        /// <param name="progressDel">Progress delegate</param>
        /// <param name="ignoreTypes">A list of ifc types to skip</param>
        /// <param name="allowMissingReferences">Allow referenced entities that are not in the model, default false</param>
        /// <param name="keepOrder">When true, serialised file will maintain order of entities from the original file (or order of creation)</param>
        /// <returns>New memory model</returns>
        public static MemoryModel OpenReadStep21(Stream stream, ILogger logger    = null, ReportProgressDelegate progressDel = null,
                                                 IEnumerable <string> ignoreTypes = null, bool allowMissingReferences        = false, bool keepOrder = true)
        {
            var model = new MemoryModel((IEnumerable <string> schemas) =>
            {
                var schema = GetStepFileXbimSchemaVersion(schemas);
                return(GetFactory(schema));
            }, logger)
            {
                AllowMissingReferences = allowMissingReferences
            };

            if (!keepOrder)
            {
                model.DiscardNaturalOrder();
            }
            model.LoadStep21(stream, stream.Length, progressDel, ignoreTypes);
            return(model);
        }