Example #1
0
        public static void  Main(System.String[] args)
        {
            if (args.Length != 1)
            {
                System.Console.Error.WriteLine("Usage: DefaultApplication message_file");
                System.Environment.Exit(1);
            }

            //read test message file ...
            try
            {
                System.IO.FileInfo     messageFile = new System.IO.FileInfo(args[0]);
                System.IO.StreamReader in_Renamed  = new System.IO.StreamReader(new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default).CurrentEncoding);
                int    fileLength = (int)SupportClass.FileLength(messageFile);
                char[] cbuf       = new char[fileLength];
                in_Renamed.Read(cbuf, 0, fileLength);
                System.String messageString = new System.String(cbuf);

                //parse inbound message ...
                Parser  parser    = new PipeParser();
                Message inMessage = null;
                try
                {
                    inMessage = parser.parse(messageString);
                }
                catch (NuGenHL7Exception e)
                {
                    SupportClass.WriteStackTrace(e, Console.Error);
                }
            }
            catch (System.Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
        }
Example #2
0
        public static void  Main(System.String[] args)
        {
            if (args.Length != 2)
            {
                System.Console.Out.WriteLine("Usage: Genetibase.NuGenHL7.app.Initiator host port");
            }

            try
            {
                //set up connection to server
                System.String host = args[0];
                int           port = System.Int32.Parse(args[1]);

                Parser             parser     = new PipeParser();
                LowerLayerProtocol llp        = LowerLayerProtocol.makeLLP();
                NuGenConnection    connection = new NuGenConnection(parser, llp, new System.Net.Sockets.TcpClient(host, port));
                NuGenInitiator     initiator  = connection.Initiator;
                System.String      outText    = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";

                //get a bunch of threads to send messages
                for (int i = 0; i < 1000; i++)
                {
                    SupportClass.ThreadClass sender = new SupportClass.ThreadClass(new System.Threading.ThreadStart(new AnonymousClassRunnable(parser, outText, initiator).Run));
                    sender.Start();
                }
            }
            catch (System.Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
        }
Example #3
0
 public virtual bool evaluate(System.Object obj)
 {
     System.String encoded = PipeParser.encode((Segment)obj, ec);
     if (encoded.Length > 3)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
		/// <summary> Reads HL7 messages from an InputStream and outputs an array of HL7 message strings
		/// 
		/// </summary>
		/// <version>  $Revision: 1.1 $ updated on $Date: 2006/02/01 18:17:57 $ by $Author: nacharya $
		/// </version>
		public static System.String[] read(System.IO.Stream theMsgInputStream)
		{
			Parser hapiParser = new PipeParser();
			
			System.IO.StreamReader in_Renamed = new System.IO.StreamReader(new CommentFilterReader(new System.IO.StreamReader(theMsgInputStream, System.Text.Encoding.Default)).BaseStream, new CommentFilterReader(new System.IO.StreamReader(theMsgInputStream, System.Text.Encoding.Default)).CurrentEncoding);
			
			System.Text.StringBuilder rawMsgBuffer = new System.Text.StringBuilder();
			
			int c = 0;
			while ((c = in_Renamed.Read()) >= 0)
			{
				rawMsgBuffer.Append((char) c);
			}
			
			System.String[] messages = getHL7Messages(rawMsgBuffer.ToString());
			
			return messages;
		}
        /// <summary> Reads HL7 messages from an InputStream and outputs an array of HL7 message strings
        ///
        /// </summary>
        /// <version>  $Revision: 1.1 $ updated on $Date: 2006/02/01 18:17:57 $ by $Author: nacharya $
        /// </version>
        public static System.String[] read(System.IO.Stream theMsgInputStream)
        {
            Parser hapiParser = new PipeParser();

            System.IO.StreamReader in_Renamed = new System.IO.StreamReader(new CommentFilterReader(new System.IO.StreamReader(theMsgInputStream, System.Text.Encoding.Default)).BaseStream, new CommentFilterReader(new System.IO.StreamReader(theMsgInputStream, System.Text.Encoding.Default)).CurrentEncoding);

            System.Text.StringBuilder rawMsgBuffer = new System.Text.StringBuilder();

            int c = 0;

            while ((c = in_Renamed.Read()) >= 0)
            {
                rawMsgBuffer.Append((char)c);
            }

            System.String[] messages = getHL7Messages(rawMsgBuffer.ToString());

            return(messages);
        }
Example #6
0
        public virtual int process(System.IO.Stream theMsgInputStream)
        {
            Parser hapiParser = new PipeParser();

            System.IO.StreamReader in_Renamed = new System.IO.StreamReader(new CommentFilterReader(new System.IO.StreamReader(theMsgInputStream, System.Text.Encoding.Default)).BaseStream, new CommentFilterReader(new System.IO.StreamReader(theMsgInputStream, System.Text.Encoding.Default)).CurrentEncoding);

            System.Text.StringBuilder rawMsgBuffer = new System.Text.StringBuilder();

            //String line = in.readLine();
            int c = 0;

            while ((c = in_Renamed.Read()) >= 0)
            {
                rawMsgBuffer.Append((char)c);
            }

            System.String[] messages = getHL7Messages(rawMsgBuffer.ToString());
            int             retVal   = 0;

            //start time
            long startTime = DateTime.UtcNow.Ticks;


            for (int i = 0; i < messages.Length; i++)
            {
                sendMessage(messages[i]);
                readAck();
                retVal++;
            }

            //end time
            long endTime = DateTime.UtcNow.Ticks;

            //elapsed time
            long elapsedTime = (endTime - startTime) / 1000;

            return(retVal);
        }
		public virtual int process(System.IO.Stream theMsgInputStream)
		{
			Parser hapiParser = new PipeParser();
			
			System.IO.StreamReader in_Renamed = new System.IO.StreamReader(new CommentFilterReader(new System.IO.StreamReader(theMsgInputStream, System.Text.Encoding.Default)).BaseStream, new CommentFilterReader(new System.IO.StreamReader(theMsgInputStream, System.Text.Encoding.Default)).CurrentEncoding);
			
			System.Text.StringBuilder rawMsgBuffer = new System.Text.StringBuilder();
			
			//String line = in.readLine();
			int c = 0;
			while ((c = in_Renamed.Read()) >= 0)
			{
				rawMsgBuffer.Append((char) c);
			}
			
			System.String[] messages = getHL7Messages(rawMsgBuffer.ToString());
			int retVal = 0;
			
			//start time			
            long startTime = DateTime.UtcNow.Ticks;
			
			
			for (int i = 0; i < messages.Length; i++)
			{
				sendMessage(messages[i]);
				readAck();
				retVal++;
			}
			
			//end time
            long endTime = DateTime.UtcNow.Ticks;
			
			//elapsed time
			long elapsedTime = (endTime - startTime) / 1000;

			return retVal;
		}
		public static void  Main(System.String[] args)
		{
			if (args.Length != 2)
			{
				System.Console.Out.WriteLine("Usage: Genetibase.NuGenHL7.app.Initiator host port");
			}
			
			try
			{
				
				//set up connection to server
				System.String host = args[0];
				int port = System.Int32.Parse(args[1]);
				
				Parser parser = new PipeParser();
				LowerLayerProtocol llp = LowerLayerProtocol.makeLLP();
				NuGenConnection connection = new NuGenConnection(parser, llp, new System.Net.Sockets.TcpClient(host, port));
				NuGenInitiator initiator = connection.Initiator;
				System.String outText = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";
				
				//get a bunch of threads to send messages
				for (int i = 0; i < 1000; i++)
				{
					SupportClass.ThreadClass sender = new SupportClass.ThreadClass(new System.Threading.ThreadStart(new AnonymousClassRunnable(parser, outText, initiator).Run));
					sender.Start();
				}
			}
			catch (System.Exception e)
			{
				SupportClass.WriteStackTrace(e, Console.Error);
			}
		}
		public static void  Main(System.String[] args)
		{
			if (args.Length != 1)
			{
				System.Console.Error.WriteLine("Usage: DefaultApplication message_file");
				System.Environment.Exit(1);
			}
			
			//read test message file ...
			try
			{
				System.IO.FileInfo messageFile = new System.IO.FileInfo(args[0]);
				System.IO.StreamReader in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default).CurrentEncoding);
				int fileLength = (int) SupportClass.FileLength(messageFile);
				char[] cbuf = new char[fileLength];
				in_Renamed.Read(cbuf, 0, fileLength);
				System.String messageString = new System.String(cbuf);
				
				//parse inbound message ...
				Parser parser = new PipeParser();
				Message inMessage = null;
				try
				{
					inMessage = parser.parse(messageString);
				}
				catch (NuGenHL7Exception e)
				{
					SupportClass.WriteStackTrace(e, Console.Error);
				}
			}
			catch (System.Exception e)
			{
				SupportClass.WriteStackTrace(e, Console.Error);
			}
		}
Example #10
0
 /// <summary>Creates a new instance of TestApplication </summary>
 public NuGenTestApplication()
 {
     parser = new PipeParser();
 }