Пример #1
0
        public void CopyAfterBlock(Block afterBlock)
        {
            IEnumerable <Block> blocksToCopy = PrepareBlocksToMove();
            IEnumerable <Block> newBlocks    = BlockActions.Clone(blocksToCopy);

            afterBlock.AppendBlocks(newBlocks);
        }
Пример #2
0
 public virtual void Clear()
 {
     if (this.Children.Count == 0)
     {
         return;
     }
     BlockActions.Delete(this.Children.ToArray());
 }
Пример #3
0
        public override string ToString()
        {
            var block = SJ(input: BlockActions.Select(el => el.ToString()));
            var id    = InitialDamage.Count == 0 ? "" : $"D{string.Join(',', InitialDamage)}";
            var ba    = string.Join(',', BlockActions.Select(el => el.Desc));
            var da    = string.Join(',', DamageAdjustments.Select(el => el.Desc));
            var s     = string.Join(',', Status.Select(el => el.ToString()));
            var res   = SJ('|', new List <string>()
            {
                block, id, ba, da, s
            }.Where(el => !string.IsNullOrEmpty(el)));

            return(res);
        }
Пример #4
0
        /// <summary>
        /// Deletes the current block.
        /// Changes the Undo stack.
        /// </summary>
        public virtual void Delete()
        {
            BlockActions.DeleteBlock(this);
            //if (this.Parent == null)
            //{
            //    return;
            //}

            //if (this.Root != null && this.Root.ActionManager != null)
            //{
            //    RemoveBlocksAction Action = new RemoveBlocksAction(this.Parent);
            //    Action.PrepareBlocks(GetBlocksToDelete());
            //    this.Root.ActionManager.RecordAction(Action);
            //}
            //else
            //{
            //    this.Parent.Children.Delete(GetBlocksToDelete());
            //}
        }
Пример #5
0
        public void AcceptBlocks(DragQuery draggedBlocks, DragQueryResult whereTo)
        {
            if (whereTo.DropTargetContainer.CanAcceptBlocks(draggedBlocks) == null)
            {
                return;
            }

            IEnumerable <Block> toDrop;

            if (draggedBlocks.ShouldCopyInsteadOfMove)
            {
                toDrop = BlockActions.Clone(draggedBlocks);
                toDrop = IntersperseWithSeparators(toDrop, whereTo);
                if (whereTo.HowToDrop == DropTargetInfo.DropBeforeTarget)
                {
                    whereTo.DropTarget.PrependBlocks(toDrop);
                }
                else
                {
                    whereTo.DropTarget.AppendBlocks(toDrop);
                }
            }
            else
            {
                using (Root.Transaction())
                {
                    foreach (Block b in draggedBlocks)
                    {
                        b.Delete();
                    }
                    toDrop = IntersperseWithSeparators(draggedBlocks, whereTo);
                    if (whereTo.HowToDrop == DropTargetInfo.DropBeforeTarget)
                    {
                        whereTo.DropTarget.PrependBlocks(toDrop);
                    }
                    else
                    {
                        whereTo.DropTarget.AppendBlocks(toDrop);
                    }
                }
            }
        }
Пример #6
0
        public static void InsertNewLineFromCurrent(Block current, Block newLine)
        {
            if (current == null)
            {
                return;
            }

            TokenLineBlock parent = current.Parent as TokenLineBlock;

            if (parent == null)
            {
                return;
            }

            if (current.Prev == null && current.Next != null)
            {
                BlockActions.Prepend(parent, newLine);
            }
            else
            {
                parent.AppendBlocks(newLine);
            }
        }
Пример #7
0
 private void AssignSetAccessor(PropertySetBlock value)
 {
     if (value == null && mSetAccessor != null)
     {
         if (GetAccessor == null)
         {
             this.ReplaceWithField();
         }
         else
         {
             BlockActions.DeleteBlock(mSetAccessor);
         }
     }
     else if (mSetAccessor == null && value != null)
     {
         this.VMembers.Add(value);
     }
     else if (mSetAccessor != null && value != null)
     {
         mSetAccessor.Replace(value);
     }
     mSetAccessor = value;
 }
Пример #8
0
 public void MoveBeforeBlock(Block beforeChild)
 {
     BlockActions.MoveBlocksBeforeBlock(PrepareBlocksToMove(), beforeChild);
 }
Пример #9
0
 public void MoveAfterBlock(Block afterChild)
 {
     BlockActions.MoveBlocksAfterBlock(PrepareBlocksToMove(), afterChild);
 }
Пример #10
0
 public void Move(ContainerBlock newParent)
 {
     BlockActions.MoveBlocks(newParent, PrepareBlocksToMove());
 }
Пример #11
0
 internal void AddBlockStep(string v, double v2, int?order = null, bool additive = true)
 {
     BlockActions.Add(new FightStep(v, v2, order, additive));
 }