/// <summary> /// The ResolveFieldName function resolves a field reference /// against the information in the dictionary. /// </summary> /// <param name="reference"> /// The field reference to resolve. /// </param> /// <returns> /// An instance of FixDxResolvedField that contains all of /// the resolved information about the field. /// </returns> private FixDxResolvedField ResolveFieldReference(FixDxFieldReference reference) { if (string.IsNullOrEmpty(reference.Name)) { string error = "The supplied field reference has an empty or null name."; throw new ArgumentException(error); } else { if (!_mapFieldsByName.ContainsKey(reference.Name)) { string error = string.Format("The field reference {0} could not be resolved!", reference.Name); throw new ArgumentException(error); } else { FixDxField dxField = _mapFieldsByName[reference.Name]; if (dxField.LengthCoded == false) { FixDxResolvedField result = new FixDxResolvedField(dxField.Tag, dxField.Name, dxField.Type, reference.Required); return(result); } else { // REC: The field is length encoded, so the field that // contains the content length for this field also has // to be resolved from the dictionary: if (_mapFieldsByName.ContainsKey(dxField.LengthField)) { FixDxField dxLength = _mapFieldsByName[dxField.LengthField]; FixDxResolvedField result = new FixDxResolvedField(dxField.Tag, dxField.Name, dxField.Type, dxLength.Tag, reference.Required); return(result); } else { string error = string.Format("The field reference {0}'s length field {1} couldn't be resolved!", dxField.Name, dxField.LengthField); throw new ArgumentException(error); } } } } }
/// <summary> /// The ResolveFieldName function resolves a field reference /// against the information in the dictionary. /// </summary> /// <param name="reference"> /// The field reference to resolve. /// </param> /// <returns> /// An instance of FixDxResolvedField that contains all of /// the resolved information about the field. /// </returns> private FixDxResolvedField ResolveFieldReference(FixDxFieldReference reference) { if (string.IsNullOrEmpty(reference.Name)) { string error = "The supplied field reference has an empty or null name."; throw new ArgumentException(error); } else { if (!_mapFieldsByName.ContainsKey(reference.Name)) { string error = string.Format("The field reference {0} could not be resolved!", reference.Name); throw new ArgumentException(error); } else { FixDxField dxField = _mapFieldsByName[reference.Name]; if (dxField.LengthCoded == false) { FixDxResolvedField result = new FixDxResolvedField(dxField.Tag, dxField.Name, dxField.Type, reference.Required); return result; } else { // REC: The field is length encoded, so the field that // contains the content length for this field also has // to be resolved from the dictionary: if (_mapFieldsByName.ContainsKey(dxField.LengthField)) { FixDxField dxLength = _mapFieldsByName[dxField.LengthField]; FixDxResolvedField result = new FixDxResolvedField(dxField.Tag, dxField.Name, dxField.Type, dxLength.Tag, reference.Required); return result; } else { string error = string.Format("The field reference {0}'s length field {1} couldn't be resolved!", dxField.Name, dxField.LengthField); throw new ArgumentException(error); } } } } }