Exemple #1
0
            public NamespaceComparer(XmlNsInfo nsInfo, Assembly assembly)
            {
                _nsInfo = nsInfo;

                // Calculate the subsume count upfront, since this also serves as our cycle detection
                _subsumeCount = new Dictionary <string, int>(nsInfo.OldToNewNs.Count);

                HashSet <string> visited = new HashSet <string>();

                // for every XmlnsCompatAttribute
                foreach (string newNs in nsInfo.OldToNewNs.Values)
                {
                    visited.Clear();

                    // Increment the subsume count for all transitive subsumers
                    string ns = newNs;
                    do
                    {
                        if (!visited.Add(ns))
                        {
                            throw new XamlSchemaException(SR.Get(SRID.XmlnsCompatCycle, assembly.FullName, ns));
                        }
                        IncrementSubsumeCount(ns);
                        ns = GetNewNs(ns);
                    }while (ns != null);
                }
            }
            public NamespaceComparer(XmlNsInfo nsInfo, Assembly assembly)
            {
                this._nsInfo       = nsInfo;
                this._subsumeCount = new Dictionary <string, int>(nsInfo.OldToNewNs.Count);
                Dictionary <string, object> dictionary = new Dictionary <string, object>();

                foreach (string str in nsInfo.OldToNewNs.Values)
                {
                    dictionary.Clear();
                    string key = str;
                    do
                    {
                        if (dictionary.ContainsKey(key))
                        {
                            throw new XamlSchemaException(System.Xaml.SR.Get("XmlnsCompatCycle", new object[] { assembly.FullName, key }));
                        }
                        dictionary.Add(key, null);
                        this.IncrementSubsumeCount(key);
                        key = this.GetNewNs(key);
                    }while (key != null);
                }
            }
 public NamespaceComparer(XmlNsInfo nsInfo, Assembly assembly)
 {
     this._nsInfo = nsInfo;
     this._subsumeCount = new Dictionary<string, int>(nsInfo.OldToNewNs.Count);
     Dictionary<string, object> dictionary = new Dictionary<string, object>();
     foreach (string str in nsInfo.OldToNewNs.Values)
     {
         dictionary.Clear();
         string key = str;
         do
         {
             if (dictionary.ContainsKey(key))
             {
                 throw new XamlSchemaException(System.Xaml.SR.Get("XmlnsCompatCycle", new object[] { assembly.FullName, key }));
             }
             dictionary.Add(key, null);
             this.IncrementSubsumeCount(key);
             key = this.GetNewNs(key);
         }
         while (key != null);
     }
 }