private static string GetNextToken(this IKernelCommand command)
        {
            if (command.Properties.TryGetValue(TokenKey, out var value) &&
                value is TokenSequence tokenSequence)
            {
                return(tokenSequence.GetNext());
            }

            return(command.GenerateToken());
        }
Exemple #2
0
        public static string GetToken(this IKernelCommand command)
        {
            if (command.Properties.TryGetValue(TokenKey, out var value) &&
                value is TokenSequence tokenSequence)
            {
                return(tokenSequence.Current);
            }

            if (command is KernelCommandBase commandBase &&
                commandBase.Parent != null)
            {
                var token = commandBase.Parent.GetToken();
                command.SetToken(token);
                return(token);
            }

            return(command.GenerateToken());
        }