コード例 #1
0
ファイル: Segment.cs プロジェクト: adamsives/learnHL72
        public Segment(string segmentText, FieldSepandEncodingChars fs)
        {
            //---------check for escaped charachters here
            Escape e = new Escape(segmentText.Trim(), fs.fieldSeparator);

            string[] ss = segmentText.Trim().Split(fs.fieldSeparator);
            foreach (string s in ss)
            {
                Field f = new Field(e.escapedString, fs);
                Fields.Add(f);
            }

            value = segmentText;
        }
コード例 #2
0
ファイル: Field.cs プロジェクト: adamsives/learnHL72
        public Field(string fieldText, FieldSepandEncodingChars fc)
        {                                                               //------test if this is a repeating field that is NOT MSH1
            if ((fieldText.Contains(fc.fieldRepeatSeparator)) && (fc.fieldSeparator.ToString() + fieldText != fc.allSpecialChars))
            {                                                           //create a subfield on the "~" delimiter
                string[] ss = fieldText.Split(fc.fieldRepeatSeparator); //---split the "~" delimited string
                foreach (string s in ss)
                {
                    SubField f = new SubField(s, fc);
                    SubFields.Add(f);
                }
            }
            else
            {
                if (fc.fieldSeparator.ToString() + fieldText == fc.allSpecialChars)
                {
                    fieldValue = fc.fieldSeparator.ToString() + fieldText;
                }
                else
                {
                    if (!fieldText.Contains(fc.subSubFieldSeparator))
                    {
                        fieldValue = fieldText;
                    }
                    else
                    {
                        //----test to find position of the '&'
                        int index = fieldText.IndexOf(fc.subSubFieldSeparator);
                        int len   = fieldText.Length;
                        int i     = 0;

                        while (i <= len)
                        {
                            // start+count must be a position within -str-.
                            if (fieldText.Substring(0, 1) == fc.escapeCharacter.ToString())
                            {
                                //this is an escaped subsubfield char
                            }
                            else
                            {
                            }
                            index++;
                            i++;
                        }

                        SubSubField ss = new SubSubField(fieldText, fc);
                    }
                }
            }
        }
コード例 #3
0
ファイル: SubSubField.cs プロジェクト: adamsives/learnHL72
 public SubSubField(string subSubFieldText, FieldSepandEncodingChars f)
 {
     if (subSubFieldText.Contains(f.subSubFieldSeparator))
     {
         string[] ss = subSubFieldText.Split(f.subSubFieldSeparator);
         foreach (string s in ss)
         {
             SubSubFields.Add(s);
         }
     }
     else if (subSubFieldText != null)
     {
         value = subSubFieldText;
     }
 }
コード例 #4
0
ファイル: HL7Message.cs プロジェクト: adamsives/learnHL72
        public HL7Message(string messageText)
        {
            ss = messageText.Trim().Split('\r');
            //--need to test for escape characters
            foreach (string s in ss)
            {
                if (s.Length > 0)
                {
                    if (s.Substring(0, 3) == "MSH")
                    {
                        fsChars = new FieldSepandEncodingChars(s.Substring(3, 5));
                    }

                    Segment seg = new Segment(s, fsChars);
                    Segments.Add(seg);
                }
            }

            value = messageText.Trim();
        }