Exemplo n.º 1
0
        private static ImageRecordEntry[] Compact(Dictionary <string, ImageRecordEntry[]> fullIndex)
        {
            int compactLength = fullIndex.Values.Sum(v => v.Length);
            var compactIndex  = new List <ImageRecordEntry>(compactLength);

            // Special case
            const string GLOBAL_KEY = "#Global";

            compactIndex.AddRange(fullIndex[GLOBAL_KEY]);

            foreach (string enclosingName in fullIndex.Keys)
            {
                if (enclosingName == GLOBAL_KEY)
                {
                    continue;
                }

                foreach (var oldEntry in fullIndex[enclosingName])
                {
                    string   memberName = oldEntry.Name;
                    string[] scopes     = { enclosingName, memberName };
                    string   fullName   = ImportManager.ScopeJoin(scopes);

                    var compactIndexEntry =
                        new ImageRecordEntry(fullName, oldEntry.Type, oldEntry.Value);
                    compactIndex.Add(compactIndexEntry);
                }
            }


            return(compactIndex.ToArray());
        }
Exemplo n.º 2
0
 public bool Equals(ImageRecordEntry other)
 {
     return(Name == other.Name && Type == other.Type && Value.Equals(other.Value));
 }