/// <summary>
        /// 解析文件
        /// </summary>
        /// <returns></returns>
        public IStoryBoardCommand[] Parse()
        {
            string[] s = File.ReadAllLines(StoryBoardCommandFile);
            StoryBoardCommandString lastStr = null;

            foreach (var line in s)
            {
                StringProcessor = new StringProcessor(line);
                StringProcessor.Process();
                bool failed;
                lastStr = StringProcessor.SpaceNum == 0
                    ? new StoryBoardCommandString(null, StringProcessor.ProcessedString, StringProcessor.SpaceNum, out failed)
                    : new StoryBoardCommandString(lastStr, StringProcessor.ProcessedString, StringProcessor.SpaceNum, out failed);
                if (!string.IsNullOrEmpty(lastStr.Command))
                {
                    if (lastStr.CurrentCommand is IStoryBoardMainCommand && !_commands.Contains(lastStr.CurrentCommand) && !failed)
                    {
                        _commands.Add(lastStr.CurrentCommand);
                    }
                }
            }
            return(_commands.ToArray());
        }
        public StoryBoardCommandString(StoryBoardCommandString last, string commandStr, int level, out bool failed)
        {
            failed = false;
            if (!IsInvalidCommand(commandStr))
            {
                Level = level;
                if (last == null)
                {
                    Parent = null;
                }
                else if (last.Parent == null || last.Level == 0)
                {
                    Parent        = last;
                    ParentCommand = last.CurrentCommand;
                }
                else if (last.Level < Level)
                {
                    Parent            = last;
                    ParentCommand     = last.CurrentCommand;
                    IsFirstSubCommand = true;
                }
                else if (last.Level == Level)
                {
                    Parent        = last.Parent;
                    ParentCommand = last.ParentCommand;
                }
                else if (last.Level > level)
                {
                    Parent        = last.Parent.Parent;
                    ParentCommand = last.Parent.ParentCommand;
                }
                var curTmp = StoryBoardTools.GetEventClassByString(commandStr);
                if (curTmp != null)
                {
                    CurrentCommand = curTmp;
                }
                else
                {
                    CurrentCommand = new StoryBoardMainCommand();
                }
                CurrentCommand.Parse(commandStr);
                if (CurrentCommand is StoryBoardMainCommand mainCommand)
                {
                    if (mainCommand.Resource is null)
                    {
                        failed = true;
                    }
                }
                if (Parent != null)
                {
                    if (ParentCommand is null)
                    {
                        var tmp = StoryBoardTools.GetEventClassByString(Parent.Command);
                        if (tmp != null)
                        {
                            ParentCommand = tmp;
                        }
                        else
                        {
                            ParentCommand = new StoryBoardMainCommand();
                        }
                    }

                    ParentCommand.Parse(Parent.Command);
                    if (CurrentCommand is IStoryBoardSubCommand subCmd)
                    {
                        ParentCommand.SubCommands.Add(subCmd);
                        subCmd.ParentCommand = ParentCommand;
                    }
                }
                Command = commandStr;
            }
            else
            {
                failed  = true;
                Command = null;
            }
        }