예제 #1
0
 private CQNotesLog(
     string header,
     string logContent)
 {
     HeaderString = header;
     Content      = logContent;
     Header       = new CQNotesLogHeader(HeaderString);
 }
예제 #2
0
        public static List <CQNotesLog> Parse(string notesLog)
        {
            List <CQNotesLog> retval = new List <CQNotesLog>();

            notesLog = notesLog.Trim("\r\n".ToCharArray());
            notesLog = notesLog.Trim("\n".ToCharArray());

            string[] splits = notesLog.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);

            int newHeadLineIndex = -1;

            for (int i = 0; i < splits.Length; ++i)
            {
                if (CQNotesLogHeader.TryParse(splits[i]))
                {
                    if (newHeadLineIndex >= 0)
                    {
                        // there was a recorded headline index
                        // now that we identified a newer one, let's create the CQNotesLog for that one first
                        CQNotesLog log = CreateNotesLog(newHeadLineIndex, i, splits);
                        retval.Add(log);
                    }

                    newHeadLineIndex = i;
                }
            }

            if (newHeadLineIndex >= 0)
            {
                // process the last note log
                CQNotesLog log = CreateNotesLog(newHeadLineIndex, splits.Length, splits);
                retval.Add(log);
            }

            return(retval);
        }