Exemplo n.º 1
0
 public void Parse(List<string> sInputLines)
 {
     items = new List<UUUElementItem>();
     if (sInputLines.Count == 0)
         return;
     Queue<string> lineQ = new Queue<string>(sInputLines.ToArray());
     string sLine = "";
     int iPos;
     if (lineQ.Count == 0)
         return;
     lineQ.Dequeue();
     if (lineQ.Count == 0)
         return;
     sLine = lineQ.Dequeue();
     Id = sLine.Substring(0, 3).Trim();
     Name = sLine.Substring(3).Trim();
     if (lineQ.Count == 0)
         return;
     lineQ.Dequeue();
     if (lineQ.Count == 0)
         return;
     sLine = lineQ.Dequeue();
     if (lineQ.Count == 0)
         return;
     iPos = sLine.IndexOf("Function:");
     if (iPos == -1)
         return;
     Function = sLine.Substring(iPos + "Function:".Length).Trim();
     lineQ.Dequeue();
     if (lineQ.Count == 0)
         return;
     List<string> miniList = new List<string>();
     while (lineQ.Count > 0)
     {
         sLine = lineQ.Dequeue().Trim();
         if (string.IsNullOrEmpty(sLine))
         {
             UUUElementItem item = new UUUElementItem();
             item.Parse(miniList);
             items.Add(item);
             miniList = new List<string>();
         }
         else
         {
             miniList.Add(sLine);
         }
     }
 }
Exemplo n.º 2
0
        public void Parse(List<string> sInputLines)
        {
            items = new List<UUUElementItem>();
            if (sInputLines.Count == 0)
                return;
            Queue<string> lineQ = new Queue<string>(sInputLines.ToArray());
            string sLine = "";
            int iPos;
            sLine = lineQ.Dequeue();
            if (sLine[3] == ' ')
            {
                Position = sLine.Substring(0, 3).Trim();
                sLine = sLine.Substring(3).Trim();
            }
            Id = sLine.Substring(0, 4).Trim();
            sLine = sLine.Substring(4).Trim();
            if (Id[0] == 'S')
            {
                List<string> miniList = new List<string>();

                iPos = sLine.LastIndexOf(" ");
                Count1 = sLine.Substring(iPos).Trim();
                sLine = sLine.Substring(0, iPos).Trim();

                iPos = sLine.LastIndexOf(" ");
                Rep = sLine.Substring(iPos).Trim();
                sLine = sLine.Substring(0, iPos).Trim();
                Name = sLine;
                int iNum = 10;
                while (lineQ.Count > 0)
                {
                    sLine = lineQ.Dequeue().Trim();
                    miniList.Add(sLine);
                    UUUElementItem item = new UUUElementItem();
                    item.Parse(miniList);
                    item.Position = iNum.ToString("D3");
                    items.Add(item);
                    miniList = new List<string>();
                    iNum += 10;
                }
            }
            else
            {
                iPos = sLine.LastIndexOf(" ");
                Count = sLine.Substring(iPos).Trim();
                sLine = sLine.Substring(0, iPos).Trim();

                if (!string.IsNullOrEmpty(Position))
                {
                    iPos = sLine.LastIndexOf(" ");
                    Count1 = sLine.Substring(iPos).Trim();
                    sLine = sLine.Substring(0, iPos).Trim();
                }

                iPos = sLine.LastIndexOf(" ");
                Rep = sLine.Substring(iPos).Trim();
                sLine = sLine.Substring(0, iPos).Trim();
                Name = sLine;
            }
        }