public int ProcessAddresses(List <Segment> lst, IEdiMessageWithAddress ediMessage) { if (!addressesFound(lst)) { return(0); } lst.RemoveWhile(seg => seg.Label != SegmentLabel.AddressNameLabel); var addrLoop = new List <Segment>(); var segmentCount = 0; while (EDIUtilities.MoveSegmentByLabel(lst, addrLoop, SegmentLabel.AddressNameLabel)) { segmentCount++; Segment nextSeg = lst[0]; while (nextSeg.Label == SegmentLabel.AddressLineLabel || nextSeg.Label == SegmentLabel.GeographicLabel || nextSeg.Label == SegmentLabel.ContactLabel) { segmentCount++; EDIUtilities.MoveSegment(lst, addrLoop, nextSeg); nextSeg = lst[0]; } ediMessage.AddAddress(process_address(addrLoop)); addrLoop.Clear(); } return(segmentCount); }
public void ProcessAddresses(List <Segment> lst, IEdiMessage ediMessage) { lst.RemoveWhile(seg => seg.Label != EDIConstants.AddressNameLabel); var addr_loop = new List <Segment>(); while (EDIUtilities.MoveSegmentByLabel(lst, addr_loop, EDIConstants.AddressNameLabel)) { SegmentCount++; Segment next_seg = lst[0]; while (next_seg.Label == EDIConstants.AddressLineLabel || next_seg.Label == EDIConstants.GeographicLabel) { SegmentCount++; EDIUtilities.MoveSegment(lst, addr_loop, next_seg); next_seg = lst[0]; } ediMessage.AddAddress(process_address(addr_loop)); addr_loop.Clear(); } }