Exemplo n.º 1
0
        /// <summary>Adds a new feature block.</summary>
        /// <param name="featureBlock">The feature block to add.</param>
        /// <returns>A new instance of <see cref="T4FeatureBlock"/>, representing <paramref name="featureBlock"/> in the T4 file.</returns>
        public T4FeatureBlock AddFeatureBlock(T4FeatureBlock featureBlock)
        {
            T4FeatureBlock anchor = GetFeatureBlocks().LastOrDefault();

            using (WriteLockCookie.Create(IsPhysical())) {
                return(anchor == null
                                        ? ModificationUtil.AddChild(this, featureBlock)
                                        : ModificationUtil.AddChildAfter(anchor, featureBlock));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a new feature block.
        /// </summary>
        /// <param name="featureBlock">The feature block to add.</param>
        /// <returns>A new instance of <see cref="T4FeatureBlock"/>, representing <paramref name="featureBlock"/> in the T4 file.</returns>
        public T4FeatureBlock AddFeatureBlock(T4FeatureBlock featureBlock)
        {
            if (featureBlock == null)
            {
                throw new ArgumentNullException("featureBlock");
            }

            T4FeatureBlock anchor = GetFeatureBlocks().LastOrDefault();

            using (this.CreateWriteLock()) {
                return(anchor == null
                                        ? ModificationUtil.AddChild(this, featureBlock)
                                        : ModificationUtil.AddChildAfter(anchor, featureBlock));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a new feature block.
        /// </summary>
        /// <param name="featureBlock">The feature block to add.</param>
        /// <returns>A new instance of <see cref="T4FeatureBlock"/>, representing <paramref name="featureBlock"/> in the T4 file.</returns>
        public T4FeatureBlock AddFeatureBlock(T4FeatureBlock featureBlock)
        {
            if (featureBlock == null)
                throw new ArgumentNullException("featureBlock");

            T4FeatureBlock anchor = GetFeatureBlocks().LastOrDefault();
            using (this.CreateWriteLock()) {
                return anchor == null
                    ? ModificationUtil.AddChild(this, featureBlock)
                    : ModificationUtil.AddChildAfter(anchor, featureBlock);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Executes the process.
 /// </summary>
 public override void Execute(Action<DaemonStageResult> commiter)
 {
     _lastFeature = File.GetFeatureBlocks().LastOrDefault();
     base.Execute(commiter);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Checks if the current token represents the beginning of a code block, if yes, parse every code block after the token.
        /// </summary>
        /// <param name="tokenNodeType">The current token type.</param>
        /// <param name="parentElement">The parent element where the potential code block will be appended as a child.</param>
        /// <returns><c>true</c> is a code block has been parsed, <c>false</c> otherwise.</returns>
        private bool TryParseCodeBlock([CanBeNull] T4TokenNodeType tokenNodeType, [NotNull] CompositeElement parentElement)
        {
            if (tokenNodeType != null) {

                T4CodeBlock codeBlock;
                if (tokenNodeType == T4TokenNodeTypes.StatementStart)
                    codeBlock = new T4StatementBlock();
                else if (tokenNodeType == T4TokenNodeTypes.ExpressionStart)
                    codeBlock = new T4ExpressionBlock();
                else if (tokenNodeType == T4TokenNodeTypes.FeatureStart)
                    codeBlock = new T4FeatureBlock();
                else
                    codeBlock = null;

                if (codeBlock != null) {
                    AppendNewChild(parentElement, ParseCodeBlock(tokenNodeType, codeBlock));
                    return true;
                }

            }
            return false;
        }