示例#1
0
        private void CheckConsolidatedLists()
        {
            if (_consolidatedFunctions == null)
            {
                _consolidatedFunctions = new GroupedList <string, FFFunction>();
                _consolidatedClasses   = new GroupedList <string, FFClass>();
                _consolidatedPermExs   = new GroupedList <string, FFPermEx>();

                foreach (var file in _files.Values)
                {
                    foreach (var func in file.Functions)
                    {
                        if (!func.Visible)
                        {
                            continue;
                        }
                        _consolidatedFunctions.Add(func.Name, func);
                    }

                    var cls = file.Class;
                    if (cls != null)
                    {
                        _consolidatedClasses.Add(cls.Name, cls);
                    }

                    foreach (var permex in file.PermExs)
                    {
                        _consolidatedPermExs.Add(permex.Name, permex);
                    }
                }
            }
        }
示例#2
0
        public static IEnumerable <XmlElementPath> GetParentElementPaths(string xml)
        {
            IDictionary <string, string> namespaces;
            var    path          = GetParentElementPathCore(xml, out namespaces);
            string lastNamespace = "";
            var    groups        = new GroupedList <string, QualifiedName>();

            foreach (QualifiedName qname in path.Elements)
            {
                groups.Add(qname.Namespace ?? "", qname);
                lastNamespace = qname.Namespace;
            }

            var orderedList = groups.ToList();

            orderedList.Sort((x, y) =>
            {
                if (x.Key == y.Key)
                {
                    return(0);
                }
                if (x.Key == lastNamespace)
                {
                    return(-1);
                }
                if (y.Key == lastNamespace)
                {
                    return(1);
                }
                return(x.Key.CompareTo(y.Key));
            });

            return(orderedList.Select(g => new XmlElementPath(g.ToArray())));
        }
示例#3
0
        public static KeyedList GetOrAddGroup(this GroupedList list, string key)
        {
            // get group (keyed list) in grouped list with specified key
            // if no group is found, new group is created and returned

            if (list.Any(g => g.Key == key))
            {
                return(list.First(g => g.Key == key));
            }
            else
            {
                var newGroup = new KeyedList(key);
                list.Add(newGroup);
                return(newGroup);
            }
        }
        private bool AdvanceEnum()
        {
            _atEnd = !_enum.MoveNext();

              if (_atEnd)
              {
            return false;
              }
              else
              {
            if (_numProcessed == 0)
            {
              _columns = _reader.Columns;
              if (_columns == null)
              {
            _columns = new string[_reader.ColumnCount];
            for (var i = 0; i < _columns.Length; i++)
            {
              _columns[i] = "Column " + (i + 1);
            }
              }
              else
              {
            var grouped = new GroupedList<string, string>();
            int valueCount;
            for (var i = 0; i < _columns.Length; i++)
            {
              valueCount = grouped.Add(_columns[i].ToLowerInvariant().Replace(' ', '_'), _columns[i]);
              if (valueCount > 1) _columns[i] = _columns[i] + " " + valueCount.ToString();
            }
              }
            }
            _numProcessed++;
            return true;
              }
        }
示例#5
0
    public static IEnumerable<XmlElementPath> GetParentElementPaths(string xml)
    {
      var path = GetParentElementPathCore(xml);
      string lastNamespace = "";
      var groups = new GroupedList<string, QualifiedName>();
      foreach (QualifiedName qname in path.Elements)
      {
        groups.Add(qname.Namespace ?? "", qname);
        lastNamespace = qname.Namespace;
      }

      var orderedList = groups.ToList();
      orderedList.Sort((x, y) =>
      {
        if (x.Key == y.Key) return 0;
        if (x.Key == lastNamespace) return -1;
        if (y.Key == lastNamespace) return 1;
        return x.Key.CompareTo(y.Key);
      });

      return orderedList.Select(g => new XmlElementPath(g.ToArray())
      {
        Namespaces = path.Namespaces
      });
    }