示例#1
0
        public new void Add(IDirective item)
        {
            item.Mother = this._Mother;
            item.Parent = this._Parent;

            DirectiveCollection.AssignTemplateTree(ref item);
            DirectiveCollection.AssignUpdateBlockIds(ref item);

            this._Mother.Pool.Register(item);

            if (item is Control control)
            {
                control.Load();
            }

            this._Queued.Enqueue(this.Count);
            base.Add(item);
        }
示例#2
0
        private void Deliver()
        {
            try
            {
                StringBuilder resultContainer = new StringBuilder();

                foreach (IDirective directive in this)
                {
                    resultContainer.Append(directive.Result);
                }

                this._Parent.Deliver(RenderStatus.Rendering, resultContainer.ToString());
            }
            catch (Exception ex)
            {
                DirectiveCollection.HandleError(ex, this._Parent);
            }
        }
示例#3
0
        private void Render(IDirective directive)
        {
            try
            {
                // Analysis Calculation
                DateTime renderBegins = DateTime.Now;

                directive.Render();

                if (directive.Parent != null)
                {
                    directive.Parent.HasInlineError |= directive.HasInlineError;
                }

                this.CreateAnalysisReport(renderBegins, directive);
            }
            catch (Exception ex)
            {
                DirectiveCollection.HandleError(ex, directive);
            }
        }
示例#4
0
 public void RequestParsing(string rawValue, DirectiveCollection childrenContainer, ArgumentCollection arguments) =>
 ParseRequested?.Invoke(rawValue, childrenContainer, arguments);
示例#5
0
        private IDirective Find(DirectiveCollection directives, string directiveId)
        {
            if (directives == null)
            {
                return(null);
            }

            foreach (IDirective directive in directives)
            {
                if (!directive.Searchable)
                {
                    continue;
                }

                if (!(directive is INameable))
                {
                    continue;
                }

                if (string.CompareOrdinal(((INameable)directive).DirectiveId, directiveId) == 0)
                {
                    return(directive);
                }

                if (directive is Control control)
                {
                    switch (control.Type)
                    {
                    case Basics.Domain.Control.ControlTypes.ConditionalStatement:
                    case Basics.Domain.Control.ControlTypes.VariableBlock:
                        directive.Render();

                        break;
                    }
                }
                else
                {
                    switch (directive.Type)
                    {
                    case DirectiveTypes.PermissionBlock:
                        directive.Render();

                        break;

                    default:
                        directive.Parse();

                        break;
                    }
                }

                IDirective result =
                    this.Find(directive.Children, directiveId);

                if (result != null)
                {
                    return(result);
                }
            }

            return(null);
        }