예제 #1
0
        private void readHeader()
        {
            ChainInfo.tagValuePair val = new ChainInfo.tagValuePair();
            string       headerRow;
            StreamReader fNew = new StreamReader(fPathName);

            try
            {
                // Scan forward to desired starting point:
                if (curReadStartPos > 0)
                {
                    // Scan forward to desired starting point:
                    fNew.BaseStream.Seek(curReadStartPos, System.IO.SeekOrigin.Begin);
                }

                for (int i = 0; i < 10000; i++)                 // more than 10K lines of header would be a problem...
                {
                    headerRow             = fNew.ReadLine();
                    this.curReadStartPos += headerRow.Length + OpenMedICUtils.newLine.Length;

                    if (headerRow == FileHandler.headerEndDelim)
                    {                           // End of the header
                                                // We are done:
                        break;
                    }
                    else if (!headerRow.StartsWith(FileHandler.headerRowLeader))
                    {                           // NOT  a new header row
                                                // Hmmm, this is a continuation of the last value!
                        val.tagValue += FileHandler.headerRowTrailer + headerRow;
                        // Now overwrite what we wrote on the last write:
                        setInitValueByTag(initValues, val);
                        // If there are even more rows, we'll update this again later...
                    }
                    else if (!OpenMedICUtils.isEmpty(headerRow))
                    {                           // NOT empty (must be a new header row)
                        val = parseHeaderRow(headerRow);
                        // Update initValues -- this is either the "live" object or
                        // it's the local-only object, depending on our mode:
                        setInitValueByTag(initValues, val);
                    }
                    // Check for run-away (unterminated) headers:
                    if (i > 9998)
                    {
                        // Bad!
                        throw new FileLoadException("The header is not terminated or too big!  "
                                                    + "Already processed " + i + " rows without finding the Header Terminator row (\""
                                                    + FileHandler.headerEndDelim + "\")!",
                                                    this.fPathName);
                    }
                }
            }
            finally
            {
                fNew.Close();
            }
        }
예제 #2
0
        /// <summary>
        /// Creates a duplicate copy of this object and all its data.
        /// </summary>
        /// <returns>A new PatientInfo object identical to this one</returns>
        public PatientInfo clone()
        {
            PatientInfo newInfo = new PatientInfo(firstName, middleName, lastName,
                                                  addr1, addr2, city, state, zip, country);

            newInfo.age = age;
            newInfo.dOB = dOB;

            if (!OpenMedICUtils.isEmpty(fullAddrInt))
            {
                newInfo.fullAddrInt = fullAddrInt;
            }
            if (!OpenMedICUtils.isEmpty(fullNameInt))
            {
                newInfo.fullNameInt = fullNameInt;
            }

            return(newInfo);
        }