Esempio n. 1
0
 public override bool Parse(string sInputLine, string sName)
 {
     if (string.IsNullOrEmpty(sInputLine.Trim()))
         return false;
     Queue<string> sLines = new Queue<string>(sInputLine.Split(Separators.DataElementSeparator).ToArray());
     if (sLines.Count == 0)
         return false;
     _Id = sName;
     _Id = sLines.Dequeue();
     TagItem itemTree = TemplateDictionary.Instance().GetItem(_Id) as TagItem;
     _Id = itemTree.Id;
     _Name = itemTree.Name;
     _Description = itemTree.Function;
     Queue<TagElementItem> qItems = new Queue<TagElementItem>(itemTree.items.ToArray());
     foreach (string sLine in sLines)
     {
         TagElementItem elementItem = qItems.Dequeue();
         BaseParsedItem item = null;
         if(elementItem.Id.IndexOfAny("0123456789".ToCharArray())==0)
             item = new ElementParsedItem();
         else
             item = new ComponentParsedItem();
         if (item.Parse(sLine,elementItem.Id))
             childs.Add(item);
     }
     return !string.IsNullOrEmpty(_Id);
 }
Esempio n. 2
0
 public override bool Parse(string sInputLine, string sName)
 {
     if (string.IsNullOrEmpty(sInputLine.Trim()))
         return false;
     string[] sLines = sInputLine.Split(Separators.ComponentDataElementSeparator);
     if (sLines.Length == 0)
         return false;
     _Id = sName;
     ComponentItem itemTree = TemplateDictionary.Instance().GetItem(_Id) as ComponentItem;
     _Id = itemTree.Id;
     _Name = itemTree.Name;
     _Description = itemTree.Description;
     Queue<ComponentItemLine> qItems = new Queue<ComponentItemLine>(itemTree.Lines.ToArray());
     foreach (string sLine in sLines)
     {
         ComponentItemLine componentItem = qItems.Dequeue();
         ElementParsedItem item = new ElementParsedItem();
         if (item.Parse(sLine, componentItem.Id))
             childs.Add(item);
     }
     return !string.IsNullOrEmpty(_Id);
 }