private static void BuildPatternGroups(string Source, int SourceLength, ref int SourceIndex, LigatureInfo[] SourceLigatureInfo, string Pattern, int PatternLength, ref int PatternIndex, LigatureInfo[] PatternLigatureInfo, ref bool PatternError, ref int PGIndexForLastAsterisk, CompareInfo Comparer, CompareOptions Options, ref PatternGroup[] PatternGroups) { PatternError = false; PGIndexForLastAsterisk = 0; PatternGroups = new PatternGroup[0x10]; int num3 = 15; PatternType nONE = PatternType.NONE; int index = 0; do { PatternGroup[] groupArray2; int num6; if (index >= num3) { PatternGroup[] array = new PatternGroup[(num3 + 0x10) + 1]; PatternGroups.CopyTo(array, 0); PatternGroups = array; num3 += 0x10; } switch (Pattern[PatternIndex]) { case '*': case 0xff0a: if (nONE != PatternType.STAR) { nONE = PatternType.STAR; PatternGroups[index].PatType = PatternType.STAR; PGIndexForLastAsterisk = index; index++; } break; case '[': case 0xff3b: { bool seenNot = false; List <Range> rangeList = new List <Range>(); if (!ValidateRangePattern(Pattern, PatternLength, ref PatternIndex, PatternLigatureInfo, Comparer, Options, ref seenNot, ref rangeList)) { PatternError = true; return; } if (rangeList.Count != 0) { if (seenNot) { nONE = PatternType.EXCLIST; } else { nONE = PatternType.INCLIST; } PatternGroups[index].PatType = nONE; PatternGroups[index].CharCount = 1; PatternGroups[index].RangeList = rangeList; index++; } break; } case '#': case 0xff03: if (nONE == PatternType.DIGIT) { groupArray2 = PatternGroups; num6 = index - 1; groupArray2[num6].CharCount++; } else { PatternGroups[index].PatType = PatternType.DIGIT; PatternGroups[index].CharCount = 1; index++; nONE = PatternType.DIGIT; } break; case '?': case 0xff1f: if (nONE == PatternType.ANYCHAR) { groupArray2 = PatternGroups; num6 = index - 1; groupArray2[num6].CharCount++; } else { PatternGroups[index].PatType = PatternType.ANYCHAR; PatternGroups[index].CharCount = 1; index++; nONE = PatternType.ANYCHAR; } break; default: { int num5 = PatternIndex; int num4 = PatternIndex; if (num4 >= PatternLength) { num4 = PatternLength - 1; } if (nONE == PatternType.STRING) { groupArray2 = PatternGroups; num6 = index - 1; groupArray2[num6].CharCount++; PatternGroups[index - 1].StringPatternEnd = num4; } else { PatternGroups[index].PatType = PatternType.STRING; PatternGroups[index].CharCount = 1; PatternGroups[index].StringPatternStart = num5; PatternGroups[index].StringPatternEnd = num4; index++; nONE = PatternType.STRING; } break; } } PatternIndex++; }while (PatternIndex < PatternLength); PatternGroups[index].PatType = PatternType.NONE; PatternGroups[index].MinSourceIndex = SourceLength; int num = SourceLength; while (index > 0) { switch (PatternGroups[index].PatType) { case PatternType.STRING: num -= PatternGroups[index].CharCount; break; case PatternType.EXCLIST: case PatternType.INCLIST: num--; break; case PatternType.DIGIT: case PatternType.ANYCHAR: num -= PatternGroups[index].CharCount; break; } PatternGroups[index].MaxSourceIndex = num; index--; } }
private static void BuildPatternGroups(string Source, int SourceLength, ref int SourceIndex, LigatureInfo[] SourceLigatureInfo, string Pattern, int PatternLength, ref int PatternIndex, LigatureInfo[] PatternLigatureInfo, ref bool PatternError, ref int PGIndexForLastAsterisk, CompareInfo Comparer, CompareOptions Options, ref PatternGroup[] PatternGroups) { PatternError = false; PGIndexForLastAsterisk = 0; PatternGroups = new PatternGroup[0x10]; int num3 = 15; PatternType nONE = PatternType.NONE; int index = 0; do { PatternGroup[] groupArray2; int num6; if (index >= num3) { PatternGroup[] array = new PatternGroup[(num3 + 0x10) + 1]; PatternGroups.CopyTo(array, 0); PatternGroups = array; num3 += 0x10; } switch (Pattern[PatternIndex]) { case '*': case 0xff0a: if (nONE != PatternType.STAR) { nONE = PatternType.STAR; PatternGroups[index].PatType = PatternType.STAR; PGIndexForLastAsterisk = index; index++; } break; case '[': case 0xff3b: { bool seenNot = false; List<Range> rangeList = new List<Range>(); if (!ValidateRangePattern(Pattern, PatternLength, ref PatternIndex, PatternLigatureInfo, Comparer, Options, ref seenNot, ref rangeList)) { PatternError = true; return; } if (rangeList.Count != 0) { if (seenNot) { nONE = PatternType.EXCLIST; } else { nONE = PatternType.INCLIST; } PatternGroups[index].PatType = nONE; PatternGroups[index].CharCount = 1; PatternGroups[index].RangeList = rangeList; index++; } break; } case '#': case 0xff03: if (nONE == PatternType.DIGIT) { groupArray2 = PatternGroups; num6 = index - 1; groupArray2[num6].CharCount++; } else { PatternGroups[index].PatType = PatternType.DIGIT; PatternGroups[index].CharCount = 1; index++; nONE = PatternType.DIGIT; } break; case '?': case 0xff1f: if (nONE == PatternType.ANYCHAR) { groupArray2 = PatternGroups; num6 = index - 1; groupArray2[num6].CharCount++; } else { PatternGroups[index].PatType = PatternType.ANYCHAR; PatternGroups[index].CharCount = 1; index++; nONE = PatternType.ANYCHAR; } break; default: { int num5 = PatternIndex; int num4 = PatternIndex; if (num4 >= PatternLength) { num4 = PatternLength - 1; } if (nONE == PatternType.STRING) { groupArray2 = PatternGroups; num6 = index - 1; groupArray2[num6].CharCount++; PatternGroups[index - 1].StringPatternEnd = num4; } else { PatternGroups[index].PatType = PatternType.STRING; PatternGroups[index].CharCount = 1; PatternGroups[index].StringPatternStart = num5; PatternGroups[index].StringPatternEnd = num4; index++; nONE = PatternType.STRING; } break; } } PatternIndex++; } while (PatternIndex < PatternLength); PatternGroups[index].PatType = PatternType.NONE; PatternGroups[index].MinSourceIndex = SourceLength; int num = SourceLength; while (index > 0) { switch (PatternGroups[index].PatType) { case PatternType.STRING: num -= PatternGroups[index].CharCount; break; case PatternType.EXCLIST: case PatternType.INCLIST: num--; break; case PatternType.DIGIT: case PatternType.ANYCHAR: num -= PatternGroups[index].CharCount; break; } PatternGroups[index].MaxSourceIndex = num; index--; } }