Example #1
0
        public override void WriteEndElement()
        {
            states.Pop();

            if (elemName == null)
            {
                return;
            }

            if (thread == null)
            {
                thread = callback.GetThread(StringSlice.Empty);
            }
            long position    = callback.CurrentPosition;
            long endPosition = callback.CurrentEndPosition;

            switch (elemName)
            {
            case "m":
                output = new Content(position, endPosition, thread, dateTime, new StringSlice(GetAndClearContent()), severity);
                break;

            case "f":
                output = new FrameBegin(position, endPosition, thread, dateTime, new StringSlice(GetAndClearContent()));
                break;

            case "ef":
                output = new FrameEnd(position, endPosition, thread, dateTime);
                break;
            }

            elemName = null;
            Reset();
        }
        public override void Visit(IFrameBegin msg)
        {
            base.Visit(msg);

            DrawTime(msg);

            Rectangle r = m.OffsetTextRect;

            bool collapsed = msg.Collapsed;

            Brush txtBrush      = ctx.InfoMessagesBrush;
            Brush commentsBrush = ctx.CommentsBrush;

            string mark = FrameBegin.GetCollapseMark(collapsed);

            if (TextLineIdx == 0)
            {
                ctx.Canvas.DrawString(
                    mark,
                    ctx.Font,
                    txtBrush,
                    r.X, r.Y);
            }

            r.X += (int)(ctx.CharSize.Width * (mark.Length + 1));

            DrawStringWithInplaceHightlight(msg, commentsBrush, r.Location);

            DrawCursorIfNeeded(msg);

            FillOutlineBackground();
            DrawFrameBeginOutline(msg);
        }
Example #3
0
        /// <summary>
        /// Update the animation.
        /// </summary>
        public void Update(float dt)
        {
            if (IsPaused)
            {
                return;
            }

            if (wantToChangedTag != null)
            {
                ReallySetTag(wantToChangedTag, wantToChangedTagReverseMode);
                wantToChangedTag            = null;
                wantToChangedTagReverseMode = false;
            }

            if (wantToSetFrameIndexFlag)
            {
                SetFrameImmediately(wantToSetFrameIndex);
            }

            if (dt == 0)
            {
                return;
            }

            if (dt < 0)
            {
                throw new Exception($"{nameof(dt)} must be positive");
            }

            if (currentTag == null)
            {
                throw new Exception("not set tag yet");
            }

            string currentExecuteTagName = currentTag.Name;


            // invoke ....
            if (isNeedStartToCallFrameAction)
            {
                FrameBegin?.Invoke(currentExecuteTagName, CurrentFrameIndex);
                isNeedStartToCallFrameAction = false;
            }

            if (currentTag.loopTime)
            {
                var lastFrame = CurrentFrameIndex;
                ElapsedTimeMoveFrame_LoopMode(CurrentFrameIndex, TimeElapsed, dt,
                                              out var beginFrameList, out var endFrameList);

                foreach (var itemIndex in beginFrameList)
                {
                    FrameBegin?.Invoke(currentExecuteTagName, itemIndex);
                }
                foreach (var itemIndex in endFrameList)
                {
                    FrameEnd?.Invoke(currentExecuteTagName, itemIndex);
                }

                if (beginFrameList.Count > 0)
                {
                    CurrentFrameIndex = beginFrameList[beginFrameList.Count - 1];
                }

                // add the remain ....
                TimeElapsed += dt;
            }
            else
            {
                var lastFrameIndex = currentTag.Frames.Count - 1;
                if (CurrentFrameIndex == lastFrameIndex && TimeElapsed > currentTag.Duration)
                {
                    // do nothing ...
                }
                else
                {
                    var curFrame = CurrentFrameIndex;
                    ElapsedTimeMoveFrame_NoLoopMode(CurrentFrameIndex, TimeElapsed, dt,
                                                    out var beginFrameList, out var endFrameList);

                    foreach (var itemIndex in beginFrameList)
                    {
                        FrameBegin?.Invoke(currentExecuteTagName, itemIndex);
                    }
                    foreach (var itemIndex in endFrameList)
                    {
                        FrameEnd?.Invoke(currentExecuteTagName, itemIndex);
                    }

                    // add the remain ....
                    if (beginFrameList.Count > 0)
                    {
                        CurrentFrameIndex = beginFrameList[beginFrameList.Count - 1];
                    }

                    TimeElapsed += dt;
                }
            }
        }
 public virtual void Visit(IFrameBegin msg)
 {
     HandleMessageText(msg,
                       ctx.CharSize.Width * (FrameBegin.GetCollapseMark(msg.Collapsed).Length + 1));
 }