Пример #1
0
        private void ParseElement(D900CdrElement element)
        {
            ID900CdrElementDefinition elementDef = DefinitionProvider.FindDefinition(element.Path);

            if (elementDef != null)
            {
                if (elementDef.Name.Length != 0)
                {
                    element.Name = elementDef.Name;
                }

                if (elementDef.Parselet.Length > 0)
                {
                    ID900Parselet parselet = ParseletProvider.FindParselet(elementDef.Parselet);
                    if (parselet != null)
                    {
                        element.Parselet         = parselet;
                        element.DefaultValueType = elementDef.ValueType;
                    }
                }
            }

            if (element.Parselet == null && !element.IsConstructed)
            {
                element.Parselet = D900ParseletProvider.Instance.FindParselet("GenericParselet");
            }

            if ((element.IsConstructed) && (!element.IsEmpty))
            {
                foreach (D900CdrElement e in (element.Value as List <D900CdrElement>))
                {
                    this.ParseElement(e);
                }
            }
        }
 public void RegisterParselet(ID900Parselet parselet)
 {
     if (!_parseletTable.ContainsKey(parselet.ParseletName))
     {
         _parseletTable.Add(parselet.ParseletName, parselet);
     }
 }
 public void RegisterParselet(ID900Parselet parselet)
 {
     if (!_parseletTable.ContainsKey(parselet.ParseletName))
     {
         _parseletTable.Add(parselet.ParseletName, parselet);
     }
 }
        private void elementsListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (elementsListView.SelectedItems.Count > 0)
            {
                ID900Parselet parselet = D900ParseletProvider.Instance.FindParselet(elementsListView.SelectedItems[0].SubItems[2].Text);

                valTypeListBox.BeginUpdate();
                valTypeListBox.Items.Clear();
                if (parselet != null)
                {
                    valTypeListBox.Items.AddRange(parselet.GetValueTypes());
                    if (String.IsNullOrEmpty(elementsListView.SelectedItems[0].SubItems[3].Text))
                    {
                        valTypeListBox.SelectedItem = parselet.DefaultValueType;
                    }
                    else
                    {
                        valTypeListBox.SelectedItem = elementsListView.SelectedItems[0].SubItems[3].Text;
                    }
                }
                valTypeListBox.EndUpdate();
            }
        }