コード例 #1
0
ファイル: Specification.cs プロジェクト: RHEAGROUP/reqifsharp
        /// <summary>
        /// Asynchronously reads the <see cref="SpecHierarchy"/> which is specific to the <see cref="Specification"/> class.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        /// <param name="token">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        protected override async Task ReadHierarchyAsync(XmlReader reader, CancellationToken token)
        {
            while (await reader.ReadAsync())
            {
                if (token.IsCancellationRequested)
                {
                    token.ThrowIfCancellationRequested();
                }

                if (await reader.MoveToContentAsync() == XmlNodeType.Element && reader.LocalName == "SPEC-HIERARCHY")
                {
                    if (token.IsCancellationRequested)
                    {
                        token.ThrowIfCancellationRequested();
                    }

                    using (var subtree = reader.ReadSubtree())
                    {
                        await subtree.MoveToContentAsync();

                        var specHierarchy = new SpecHierarchy(this, this.ReqIFContent, this.loggerFactory);
                        await specHierarchy.ReadXmlAsync(subtree, token);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Reads the <see cref="SpecType"/> which is specific to the <see cref="Specification"/> class.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        /// <param name="token">
        /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        private async Task DeserializeSpecHierarchyAsync(XmlReader reader, CancellationToken token)
        {
            while (await reader.ReadAsync())
            {
                if (token.IsCancellationRequested)
                {
                    token.ThrowIfCancellationRequested();
                }

                if (await reader.MoveToContentAsync() == XmlNodeType.Element && reader.LocalName == "SPEC-HIERARCHY")
                {
                    if (bool.TryParse(reader.GetAttribute("IS-TABLE-INTERNAL"), out var isTableInternal))
                    {
                        this.IsTableInternal = isTableInternal;
                    }

                    if (token.IsCancellationRequested)
                    {
                        token.ThrowIfCancellationRequested();
                    }

                    using (var subtree = reader.ReadSubtree())
                    {
                        await subtree.MoveToContentAsync();

                        var specHierarchy = new SpecHierarchy(this, this.Root, this.ReqIfContent, this.loggerFactory);
                        await specHierarchy.ReadXmlAsync(subtree, token);
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SpecHierarchy"/> class.
        /// </summary>
        /// <param name="container">
        /// The container.
        /// </param>
        /// <param name="root">
        /// The root.
        /// </param>
        /// <param name="reqIfContent">
        /// The requirement core information content.
        /// </param>
        /// <param name="loggerFactory">
        /// The (injected) <see cref="ILoggerFactory"/> used to setup logging
        /// </param>
        internal SpecHierarchy(SpecHierarchy container, Specification root, ReqIFContent reqIfContent, ILoggerFactory loggerFactory)
            : base(loggerFactory)
        {
            this.logger = this.loggerFactory == null ? NullLogger <SpecHierarchy> .Instance : this.loggerFactory.CreateLogger <SpecHierarchy>();

            this.Initialize(container, root, reqIfContent);
            this.Container.Children.Add(this);
        }
コード例 #4
0
ファイル: Specification.cs プロジェクト: RHEAGROUP/reqifsharp
        /// <summary>
        /// Reads the <see cref="SpecHierarchy"/> which is specific to the <see cref="Specification"/> class.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        protected override void ReadHierarchy(XmlReader reader)
        {
            while (reader.Read())
            {
                if (reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "SPEC-HIERARCHY")
                {
                    using (var subtree = reader.ReadSubtree())
                    {
                        subtree.MoveToContent();

                        var specHierarchy = new SpecHierarchy(this, this.ReqIFContent, this.loggerFactory);
                        specHierarchy.ReadXml(subtree);
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Reads the <see cref="SpecType"/> which is specific to the <see cref="Specification"/> class.
        /// </summary>
        /// <param name="reader">
        /// an instance of <see cref="XmlReader"/>
        /// </param>
        private void DeserializeSpecHierarchy(XmlReader reader)
        {
            while (reader.Read())
            {
                if (reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "SPEC-HIERARCHY")
                {
                    if (bool.TryParse(reader.GetAttribute("IS-TABLE-INTERNAL"), out var isTableInternal))
                    {
                        this.IsTableInternal = isTableInternal;
                    }

                    using (var subtree = reader.ReadSubtree())
                    {
                        subtree.MoveToContent();
                        var specHierarchy = new SpecHierarchy(this, this.Root, this.ReqIfContent, this.loggerFactory);
                        specHierarchy.ReadXml(subtree);
                    }
                }
            }
        }
コード例 #6
0
ファイル: SpecHierarchy.cs プロジェクト: zaucker/reqifsharp
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecHierarchy"/> class.
 /// </summary>
 /// <param name="container">
 /// The container.
 /// </param>
 /// <param name="root">
 /// The root.
 /// </param>
 /// <param name="reqIfContent">
 /// The requirement core information content.
 /// </param>
 internal SpecHierarchy(SpecHierarchy container, Specification root, ReqIFContent reqIfContent)
 {
     this.Initialize(container, root, reqIfContent);
     this.Container.Children.Add(this);
 }
コード例 #7
0
ファイル: SpecHierarchy.cs プロジェクト: zaucker/reqifsharp
 /// <summary>
 /// The initialize.
 /// </summary>
 /// <param name="container">
 /// The container.
 /// </param>
 /// <param name="root">
 /// The root.
 /// </param>
 /// <param name="reqIfContent">
 /// The requirement core information content.
 /// </param>
 private void Initialize(SpecHierarchy container, Specification root, ReqIFContent reqIfContent)
 {
     this.Container    = container;
     this.Root         = root;
     this.ReqIfContent = reqIfContent;
 }