Example #1
0
 public static unsafe long GetId64Ex(this IId64DataRW <char> dataRW, string name)
 {
     fixed(char *pName = name)
     {
         return(dataRW.GetId64(ref pName[0], name.Length));
     }
 }
Example #2
0
        public long InternalReadNameId64(IId64DataRW <char> id64DataRW)
        {
            const char escape_char  = '\\';
            const char unicode_char = 'u';

            var text_char   = chars[index];
            var text_length = 0;

            for (int i = (++index); i < length; ++i, ++text_length)
            {
                var current_char = chars[i];

                if (current_char == text_char)
                {
                    /* 内容没有转义符,直接截取返回。 */
                    if (i - index == text_length)
                    {
                        var result = id64DataRW.GetId64(ref chars[index], text_length);

                        index = i + 1;

                        return(result);
                    }

                    return(id64DataRW.GetId64(GetNameId64(i)));
                }

                if (current_char == escape_char)
                {
                    ++i;

                    if (i < length && chars[i] == unicode_char)
                    {
                        i += 4;
                    }
                }
            }

            throw GetException();
        }
Example #3
0
        public long InternalReadNameId64(IId64DataRW <char> id64DataRW)
        {
            const char escape_char  = '\\';
            const char unicode_char = 'u';

            var text_char   = *current;
            var text_length = 0;

            for (var index = (++current); index < end; ++index, ++text_length)
            {
                var current_char = *index;

                if (current_char == text_char)
                {
                    /* 内容没有转义符,直接截取返回。 */
                    if (index - current == text_length)
                    {
                        var result = id64DataRW.GetId64(ref current[0], text_length);

                        current = index + 1;

                        return(result);
                    }

                    return(id64DataRW.GetId64Ex(InternalReadEscapeString(index, text_length)));
                }

                if (current_char == escape_char)
                {
                    ++index;

                    if (index < end && *index == unicode_char)
                    {
                        index += 4;
                    }
                }
            }

            throw GetException();
        }