Exemplo n.º 1
0
        private void ParseType(List<AlphabetType> _commands, ref int _indexParse, XmlNode _typeDefinition)
        {
            while (true)
            {
                if (_indexParse >= _commands.Count)
                    break;

                AlphabetType command = _commands[_indexParse];
                _indexParse ++;
                if (command.Direction == StateDirection.Up)
                {
                    break;
                }
                else if (command.Direction == StateDirection.Down)
                {
                    CompoundType type = new CompoundType();
                    mTemplateTypes.Add(type);

                    type.ParseType(_commands, ref _indexParse, _typeDefinition);
                }
                else
                {
                    if (command.Element != null)
                    {
                        if (mBaseType == null)
                        {
                            string refid = command.Element.Attributes["refid"].Value;
                            if (CompoundManager.Instance.IsIgnoredCompound(refid))
                            {
                                ConsoleUtility.WriteErrorLine("{0} id and name {1} not found in type {2}", refid, command.Element.InnerText, _typeDefinition.InnerXml);
                            }
                            else
                            {
                                var compound = CompoundManager.Instance.GetCompound(refid);
                                if (compound == null)
                                {
                                    ConsoleUtility.WriteErrorLine("{0} id and name {1} not found in type {2}", refid, command.Element.InnerText, _typeDefinition.InnerXml);
                                }
                                else
                                {
                                    mBaseType = compound;
                                }
                            }
                        }
                        else
                        {
                            ConsoleUtility.WriteErrorLine("Error parse type {0}", _typeDefinition.InnerXml);
                        }
                    }
                    else if (command.Text != null)
                    {
                        mParseType += command.Text;
                    }
                    else
                    {
                        ConsoleUtility.WriteErrorLine("Error parse type {0}", _typeDefinition.InnerXml);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void ParseType(List <AlphabetType> _commands, ref int _indexParse, XmlNode _typeDefinition)
        {
            while (true)
            {
                if (_indexParse >= _commands.Count)
                {
                    break;
                }

                AlphabetType command = _commands[_indexParse];
                _indexParse++;
                if (command.Direction == StateDirection.Up)
                {
                    break;
                }
                else if (command.Direction == StateDirection.Down)
                {
                    CompoundType type = new CompoundType();
                    mTemplateTypes.Add(type);

                    type.ParseType(_commands, ref _indexParse, _typeDefinition);
                }
                else
                {
                    if (command.Element != null)
                    {
                        if (mBaseType == null)
                        {
                            string refid = command.Element.Attributes["refid"].Value;
                            if (CompoundManager.Instance.IsIgnoredCompound(refid))
                            {
                                ConsoleUtility.WriteErrorLine("{0} id and name {1} not found in type {2}", refid, command.Element.InnerText, _typeDefinition.InnerXml);
                            }
                            else
                            {
                                var compound = CompoundManager.Instance.GetCompound(refid);
                                if (compound == null)
                                {
                                    ConsoleUtility.WriteErrorLine("{0} id and name {1} not found in type {2}", refid, command.Element.InnerText, _typeDefinition.InnerXml);
                                }
                                else
                                {
                                    mBaseType = compound;
                                }
                            }
                        }
                        else
                        {
                            ConsoleUtility.WriteErrorLine("Error parse type {0}", _typeDefinition.InnerXml);
                        }
                    }
                    else if (command.Text != null)
                    {
                        mParseType += command.Text;
                    }
                    else
                    {
                        ConsoleUtility.WriteErrorLine("Error parse type {0}", _typeDefinition.InnerXml);
                    }
                }
            }
        }