// Extract content from the document at the current position, converting it to // the appropriate content type if requested. void ProcessByByteFormat( ByteFormatContext byteFormat, int bytes, string byteLabel, string regionName, string ruleLabel, string describedBy, string ruleComment) { this.parseActions[regionName].Add( new ParseAction((content, startingContentPosition, contentPosition) => { if (!String.IsNullOrEmpty(byteLabel)) { bytes = GetByteCountFromLabel(byteLabel); } string parser = byteFormat.GetText(); object element = null; // If this is a native expression, process it that way if (parser[0] == '{') { element = EvaluateNativeExpression <Object>(parser, results.Peek(), content, contentPosition, bytes); } else { ValidateRuleByteSize(ruleLabel, bytes, ByteParsers[byteFormat.GetText()].Item1); element = ByteParsers[parser].Item2(content, (int)contentPosition, (int)bytes); } ParseElement(ruleLabel, element, describedBy, ruleComment); return((int)bytes); } )); }
// Extract content from the document at the current position, converting it to // the appropriate content type if requested. void ProcessByByteFormat( ByteFormatContext byteFormat, int bytes, string byteLabel, string regionName, string ruleLabel, string describedBy, string ruleComment) { this.parseActions[regionName].Add( new ParseAction((content, contentPosition) => { if (!String.IsNullOrEmpty(byteLabel)) { bytes = GetByteCountFromLabel(byteLabel); } ValidateRuleByteSize(ruleLabel, bytes, ByteParsers[byteFormat.GetText()].Item1); object element = ByteParsers[byteFormat.GetText()].Item2(content, (int)contentPosition, (int)bytes); ParseElement(ruleLabel, element, describedBy, ruleComment); return((int)bytes); } )); }