コード例 #1
0
        private ReadResults ParseNameOrUuid()
        {
            ReadResults readResults = Reader.ReadString(out string s);

            if (!readResults.Successful)
            {
                return(readResults);
            }

            if (UUID.TryParse(s, out _))
            {
                IncludesEntities = true;
            }
            else
            {
                if (string.IsNullOrEmpty(s) || s.Length > 16)
                {
                    Reader.SetCursor(Start);
                    return(ReadResults.Failure(CommandError.InvalidNameOrUuid().WithContext(Reader)));
                }
                IncludesEntities = false;
            }

            MaxResults   = 1;
            SelectorType = SelectorType.None;
            return(ReadResults.Success());
        }