/// <summary> /// 根据枚举字符串查找目标索引 /// </summary> /// <param name="xmlDeSerializer">XML解析器</param> /// <returns>目标索引,null返回-1</returns> private int searchCDataFlagEnum(XmlDeSerializer xmlDeSerializer) { byte *currentState = State; do { char *prefix = (char *)(currentState + *(int *)currentState); if (*prefix != 0) { if (xmlDeSerializer.NextCDataEnumChar() != *prefix) { return(-1); } while (*++prefix != 0) { if (xmlDeSerializer.NextCDataEnumChar() != *prefix) { return(-1); } } } char value = xmlDeSerializer.NextCDataEnumChar(); if (value == 0 || value == ',') { return(xmlDeSerializer.State == DeSerializeState.Success ? *(int *)(currentState + sizeof(int) * 2) : -1); } if (*(int *)(currentState + sizeof(int)) == 0) { return(-1); } int index = value < 128 ? (int)*(ushort *)(charsAscii + (value << 1)) : getCharIndex(value); byte *table = currentState + *(int *)(currentState + sizeof(int)); if (tableType == 0) { if ((index = *(table + index)) == 0) { return(-1); } currentState = State + index * 3 * sizeof(int); } else if (tableType == 1) { if ((index = (int)*(ushort *)(table + index * sizeof(ushort))) == 0) { return(-1); } currentState = State + index * 3 * sizeof(int); } else { if ((index = *(int *)(table + index * sizeof(int))) == 0) { return(-1); } currentState = State + index; } }while (true); }