Example #1
0
 public void PostProcess(IProcessingState state)
 {
     for (int i = 0; i < PostProcessActions.Length; i++)
     {
         PostProcessActions[i](state);
     }
 }
Example #2
0
 public void Initialize()
 {
     _cssRegistrator = Substitute.For <ICssRegistrator>();
     _styleConveter  = Substitute.For <IStyleConverter>();
     _styleConveter.BuildRegistrator().Returns(_cssRegistrator);
     _config   = new StyleConfig();
     _instance = new StylePlugin(_styleConveter, _config);
     _css      = new StringBuilder();
     _state    = Substitute.For <IProcessingState>();
     _state.Css.Returns(_css);
     _state.Elements.Returns(_ => new ElementProcessingState[0]);
     _state.GetContext(out ICssRegistrator _)
     .Returns(x =>
     {
         x[0] = _cssRegistrator;
         return(true);
     });
     _parentVNode  = new VNode();
     _currentVNode = new VNode();
     _elemState    = Substitute.For <IElementProcessingState>();
     _elemState.ProcessingState.Returns(_state);
     _elemState
     .GetContext(out ParagraphContext _)
     .Returns(x =>
     {
         x[0] = new ParagraphContext {
             Parent = _parentVNode
         };
         return(true);
     });
     _elemState.CurrentVNode.Returns(_ => _currentVNode);
 }
Example #3
0
        public void Process(Processing process, out IProcessingState timeoutState)
        {
            process.Modules = new Modules();
            process.Modules.Init();

            timeoutState = new NextAnalysis();
        }
Example #4
0
 public void Process(Processing process, out IProcessingState timeoutState)
 {
     process.Modules.CurrentAnalysisIndex++;
     if (process.Modules.CurrentAnalysisIndex < process.Modules.Amount())
     {
         timeoutState = new ProcessAnalysis();
     }
     else
     {
         timeoutState = new Idle(5);
     }
 }
Example #5
0
        public void PostProcessing(IProcessingState state)
        {
            var cssData = new CssData();

            foreach (var elemState in state.Elements)
            {
                if (elemState.GetContext(out TableContext tc))
                {
                    cssData.AddRange(tc.GetCssData());
                }
            }
            state.Css.Append(CSS);
            cssData.RenderInto(state.Css);
        }
Example #6
0
 public void Initialize()
 {
     _config = new TextProcessorConfig()
     {
         ParagraphCls = "pcls",
         HyperLinkCls = "hcls",
         RunCls       = "rcls"
     };
     _instance     = new TextProcessorPlugin(_config);
     _state        = Substitute.For <IProcessingState>();
     _elementState = Substitute.For <IElementProcessingState>();
     _elementState.CurrentVNode.Returns(new VNode("div"));
     _elementState
     .When(x => x.CurrentVNode = Arg.Any <VNode>())
     .Do(x => _currentNode     = x.Arg <VNode>());
 }
Example #7
0
        public void PostProcess(IProcessingState state)
        {
            if (!state.GetContext(out ICssRegistrator registrator))
            {
                return;
            }

            var marginApplier = new MarginApplier(state.Elements);

            marginApplier.Apply();

            var css = new CssData();

            registrator.InsertCss(css);
            css.RenderInto(state.Css);
        }
Example #8
0
        public void AddCss(IProcessingState state)
        {
            var css =
                $".{_config.ContainerCls} {{ display: flex; }} " +
                $"{_config.ContainerTag}.{_config.ContainerCls} >" +
                $" {_config.ParagraphTag} {{ flex: 1;  margin: 0; }}" +
                $".{_config.BreakAtStartCssCls} {{flex-direction: column;}}" +
                $".{_config.ContainerCls}.{_config.BreakAtStartCssCls} .{_config.LeftIdentationCls} {{text-align: center;}}" +
                $".{_config.ContainerCls}.{_config.BreakAtStartCssCls} .{_config.LeftIdentationCls} * {{padding: 0!important;}}";

            state.Css.Append(css);

            foreach (var elemState in state.Elements)
            {
                if (elemState.GetContext(out ParagraphContext c))
                {
                    c.CustomCss.RenderInto(state.Css);
                }
            }
        }
Example #9
0
        public bool GetGUIMessage(out IProcessingState state, int timeout = 0)
        {
            int counter = 0;
            while (counter <= timeout)
            {
                if (_toProcessingQueue.Count != 0)
                {
                    state = _toProcessingQueue.Dequeue();
                    return false;
                }
                else
                {
                    counter += 5;
                    Thread.Sleep(5);
                }
            }

            state = null;
            return true;
        }
Example #10
0
 public void Process(Processing process, out IProcessingState timeoutState)
 {
     timeoutState = new Idle(5);
 }
Example #11
0
        public void PostProcessing(IProcessingState state)
        {
            string css = GenCss(_config);

            state.Css.Append(css);
        }
Example #12
0
 public void SetState(IProcessingState state)
 {
     State    = state.GetState(this);
     Modified = DateTime.UtcNow;
 }
Example #13
0
 public void Initalize()
 {
     _processingState = Substitute.For <IProcessingState>();
     _elementContext  = Substitute.For <IElementProcessingState>();
 }
Example #14
0
 public virtual bool ProcessParagraph(IProcessingState ctx, Paragraph p) => true;
Example #15
0
 public virtual void PreProccess(IProcessingState ctx, object something)
 {
 }
Example #16
0
 public void SendGUIMessage(IProcessingState state)
 {
     _toProcessingQueue.Enqueue(state);
 }
Example #17
0
 public virtual void PreProcess(IProcessingState ctx)
 {
 }
 public void SetState(IProcessingState state)
 {
     State = state.GetState(this);
     Modified = DateTime.UtcNow;
 }
Example #19
0
 public void PreProcess(IProcessingState state)
 {
     state.SetContext(_styleConverter.BuildRegistrator());
 }
Example #20
0
        public void AddCss(IProcessingState state)
        {
            string css = CSS(_config);

            state.Css.Append(css);
        }
Example #21
0
 public void Process(Processing process, out IProcessingState timeoutState)
 {
     timeoutState = new Abort();
     process.Communication.SendProcessingEvent(new AnalysisEnded());
     process.Stop = true;
 }
Example #22
0
 public virtual void PostProcessing(IProcessingState ctx)
 {
 }
Example #23
0
 public void PostProcess(IProcessingState state)
 {
     state.Css.Append($".{CLASS_NAME}, .{CLASS_NAME} > span {{color: red;}}");
 }
Example #24
0
 public void Process(Processing process, out IProcessingState timeoutState)
 {
     timeoutState = new Idle(5);
     Thread.Sleep(_sleepTime);
 }