Пример #1
0
        private static NetworkMessage ParseMessage(Iso8583Bitmap bitmap, MessageReader mr, Iso8583MessageType messageType)
        {
            NetworkMessage message = new NetworkMessage(messageType);

            message.Bitmap = bitmap;

            // initialize the factory
            message.Factory = Iso8583ElementFactory.GetConfiguredFactory(mr, messageType);

            // read the primary bitmap
            DataElementId currentElement = bitmap.GetNextDataElement();

            do
            {
                message.elements[currentElement] = message.Factory.CreateElement(currentElement);
                currentElement = bitmap.GetNextDataElement();
            }while (currentElement != 0);

            // check for secondary bitmap
            if (message.Has(DataElementId.DE_001))
            {
                byte[]        secondaryBuffer = message.GetByteArray(DataElementId.DE_001);
                Iso8583Bitmap secondaryMap    = new Iso8583Bitmap(secondaryBuffer, 64);

                currentElement = secondaryMap.GetNextDataElement();
                while (currentElement != 0)
                {
                    message.elements[currentElement] = message.Factory.CreateElement(currentElement);
                    currentElement = secondaryMap.GetNextDataElement();
                }
            }

            // return the document
            return(message);
        }
Пример #2
0
 public NetworkMessage(Iso8583MessageType messageType = Iso8583MessageType.CompleteMessage)
 {
     this.messageType = messageType;
     elements         = new Dictionary <DataElementId, Iso8583Element>();
     Factory          = Iso8583ElementFactory.GetConfiguredFactory(messageType);
 }