public CLogEncodingCLogTypeSearch FindTypeAndAdvance(string encoded, CLogLineMatch traceLineMatch, ref int index) { int tempIndex = index; CLogEncodingCLogTypeSearch ret = null; if (null != (ret = TypeEncoders.FindTypeAndAdvance(encoded, traceLineMatch, ref tempIndex))) { InUseTypeEncoders.AddType(ret); index = tempIndex; return(ret); } foreach (var config in ChainedConfigurations) { tempIndex = index; if (null != (ret = config.TypeEncoders.FindTypeAndAdvance(encoded, traceLineMatch, ref tempIndex))) { InUseTypeEncoders.AddType(ret); index = tempIndex; return(ret); } } throw new CLogTypeNotFoundException("InvalidType:" + encoded, encoded, traceLineMatch); }
public CLogEncodingCLogTypeSearch FindTypeAndAdvance(string encoded, CLogLineMatch traceLineMatch, ref int index) { int tempIndex = index; CLogEncodingCLogTypeSearch ret = null; // // First scan the type encoders in our main config file // if (null != (ret = TypeEncoders.FindTypeAndAdvance(encoded, traceLineMatch, ref tempIndex))) { InUseTypeEncoders.AddType(ret); index = tempIndex; return(ret); } // // If we're unable to locate the type, iterate across each of our chained configs - note this is // recursive; such allowing for heirarchies // foreach (var config in ChainedConfigurations) { tempIndex = index; if (null != (ret = config.FindTypeAndAdvance(encoded, traceLineMatch, ref tempIndex))) { InUseTypeEncoders.AddType(ret); index = tempIndex; return(ret); } } // // Attempt to get something for the user about the actual arg; note this may be error prone as we are now confused // by their inputs // string surroundingArray = encoded.Substring(index, 15); int end = surroundingArray.IndexOf("}"); if (-1 != end) { surroundingArray = surroundingArray.Substring(0, end); } throw new CLogTypeNotFoundException(encoded, "InvalidType:" + surroundingArray, traceLineMatch); }